使用公钥访问码云

1.本地进入.ssh查看是否存在密钥对:xxx和xxx.pub

命令:cd ~/.ssh

2.如果不存在,使用ssh-keygen来创建

命令:ssh-keygen -t rsa -C "[email protected]"
例如:ssh-keygen -t rsa -C "[email protected]"
注解:
Enter file in which to save the key 输入保存秘钥的文件 直接enter即可
Enter passphrase (empty for no passphrase) 输入密码 直接enter即可
此时查看.ssh目录下可看到新增的一对秘钥id_rsa和id_rsa.pub

3.把id_rsa.pub中的公钥复制到gitee设置-安全设置-ssh公钥中

4.如果以前是使用https下载的代码需要把https切换到ssh

git remote set-url origin 仓库ssh地址

转载于:https://www.cnblogs.com/missile/p/10526689.html

你可能感兴趣的:(使用公钥访问码云)