bitbucket 配置 SSH keys

目录

问题

配置方法

生成SSH key

添加SSH key至SSH Agent

添加公钥至Bitbucket

执行Git clone


问题

拉取bitbucket上的代码需要配置SSH key

Configure SSH and two-step verification | Bitbucket Cloud | Atlassian Support

以Linux为例:

Set up personal SSH keys on Linux | Bitbucket Cloud | Atlassian Support

配置方法

生成SSH key

  1. Open a terminal and navigate to your home or user directory using cd, for example:

    $ cd ~/.ssh/

  2. Generate a SSH key pair using ssh-keygen, such as:

    $ ssh-keygen -t ed25519 -b 4096 -C "{[email protected]}" -f {ssh-key-name}

    Where:

    • {[email protected]} is the email address associated with the Bitbucket Cloud account, such as your work email account.

    • {ssh-key-name} is the output filename for the keys. We recommend using a identifiable name such as bitbucket_work.

添加SSH key至SSH Agent

  1. To allow git to use your SSH key, an SSH agent needs to be running on your device.

    To check if it is already running, run the ps command. If the ssh-agent is already running, it should appear in the output, such as:

    $ ps -auxc | grep ssh-agent
    myusername      3291  0.0  0.0   6028   464 ?        Ss   07:29   0:00 ssh-agent

    To start the agent, run:

    $ eval $(ssh-agent)

  2. Run the following command, replacing the {ssh-key-name} with the name of the private key:

    $ ssh-add ~/.ssh/{ssh-key-name}

添加公钥至Bitbucket

 bitbucket 配置 SSH keys_第1张图片

执行Git clone

bitbucket 配置 SSH keys_第2张图片 

 

你可能感兴趣的:(Git,ssh,服务器,运维,bitbucket)