How Git uses the Generate SSH personal public key to access the Git repository method ( here, for example, the coding platform ):
1. Get the SSH protocol address
In the Project code page click SSH Switch to SSH protocol, get access address, please use this address to visit your code warehouse, such as:
2. Generating the public key
Mac/linux Open the command-line terminal, Windows opens Git Bash. Enter Ssh-keygen-t rsa-c "[email protected]", (registered mailbox), then click the Enter key (you can also enter the password).
$ssh-keygen-t Rsa-b4096-c "[email protected]" //Press Enter enter # creates a new SSH key, using the provided email as a label# genera Ting public/private RSA key pair. enter file in which to save the key ( /users/you /.ssh/id_rs a ) : [press Enter]
//The default address is recommended and may need to be configured if you use a nondefault address. Ssh/config, the generated public key file can be seen in the corresponding directory under the preceding row
After success
Your identification has been savedInch/users/you/.ssh/id_rsa.# Yourpublic Key has been saved in /Users/ You/.ssh/id_rsa.pub.# the key fingerprint is:# 01:0f:f4:3b:ca:85:d6:17:a1:7< Span class= "hljs-string" >d:f0:68: 9d:f0:a2:db Your_email @example. com
3. Add a public key in Coding.net
- Open the Id_rsa.pub file locally (or execute $cat id_rsa.pub), copy all of it, and add it to the account "SSH public key" page, the public key name can be arbitrary name.
- A
- Click "Add" and then enter the password or the dynamic code to add the completion.
- Upon completion of the command line test, the first build of the link will require a trusted host.
$ ssh-t [email protected] // 按回车enter
Enter passphrase for key '/c/users/yuankai/.ssh/id_rsa ': coding.net Tips: [Hello kyle_lyk! You have connected to Coding.net by SSH successfully! ] `
Note: The same public key can only be bound to one account, Coding temporarily does not support the same public key binding multiple accounts.
If you need to use multiple accounts to suggest generating multiple public keys, you can add the bottom paragraph to the. ssh/config file
Host git.coding.net User [email protected].com PreferredAuthentications publickey IdentityFile ~/.ssh/coding_rsa // 生成的非默认地址的公钥存放点
4. How to download the remote Git repository code locally via SSH public key mode:
1. In the local directory, right-click the GIT GUI here to open the GUI window and select the repository that already exists as:
2. Enter the GIT repository SSH address as stated above
OK, I wish you success, have the above questions can leave a message to discuss together!
How to use the Generate SSH personal public key to access the Git repository in git