一、码云创建ssh公钥
1)生成生成ssh公钥,跟着步骤执行这些命令:
ssh-keygen-trsa-C"xxxxx@xxxxx.com"
将邮箱替换成码云注册邮箱。
回车三次即可生成sshkey
2)查看 public key,并把他添加到码云(Gitee.com)
cat ~/.ssh/id_rsa.pub
将ssh-rsa到邮箱部分的内容复制出来
3)添加用户sshkey
通过个人》设置,添加ssh公钥
二、变更为ssh协议认证
1)将https协议认证变成ssh协议认证
git remote rm origin
将远程的提交方式删除,然后添加新的提交方式
git remote add origin git@github.com:xxx/xxx.git
2)提交代码
gitpush-u origin master
网友评论