####### 配置公钥私钥
用git去管理代码现在已经属于主流了,所以配置SSH会防止每次pull,push 都需要输入账号密码。
Mac/Linux 打开命令行终端, Windows 打开 Git Bash 。 输入ssh-keygen -t rsa -C “username@example.com”,( 注册的邮箱),接下来点击enter键即可(也可以输入密码)。
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
成功之后
Your identification has been saved in /Users/you/.ssh/id_rsa.
# Your public key has been saved in /Users/you/.ssh/id_rsa.pub.
# The key fingerprint is:
# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
$ cd ~/.ssh
$ ls
$ cat id_rsa.pub
复制其中全部内容,添加到账户[“SSH 公钥”页面](https://coding.net/user/account/setting/keys) 中,公钥名称可以随意起名字。
命令行测试,首次建立链接会要求信任主机。
$ ssh -T git@git.coding.net
// 注意 git.coding.net 接入到 CDN 上所以会解析多个不同的
host ip The authenticity of host ‘git.coding.net (61.146.73.68)’ can not be established.
RSA key fingerprint is 98:ab:2b:30:60:00:82:86:bb:85:db:87:22:c4:4f:b1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘git.coding.net,61.146.73.68’ (RSA) to the list of kn own hosts.
Enter passphrase for key ‘/c/Users/liubiaocong/.ssh/id_rsa’: Coding.net Tips :
[ Hello Kyle_lyk! You have connected to Coding.net by SSH successfully! ] `
PS : 如果要配置SSH 一定要clone 遵守SSH协议的 git@xxxx地址,不要克隆https://xxxxx的地址。 这真是个大坑!