- 1.配置账号密码
$ git config --global user.name "zonghzha"
$ git config --global user.email zonghzha@cisco.com
2.拉取代码报错
$ git pull origin master:master
The authenticity of host 'gitee.com (212.64.62.183)' can't be established.
ED25519 key fingerprint is SHA256:+ULzij2u99B9eWYFTw1Q4ErYG/aepHLbu96PAUCoV88.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitee.com' (ED25519) to the list of known hosts.
git@gitee.com: Permission denied (publickey).
fatal: Could not read from remote repository.
这是因为电脑上的公钥没有添加到git远程服务器账号下:
- 生成公钥
ssh-keygen -t rsa -C "zonghzha@cisco.com"
- 查看公钥
cat ~/.ssh/id_rsa.pub
- 将新生成的公钥添加到你的远程Git服务账号下
- 添加完成之后,再在本地Git Bash上验证一下
ssh -T git@gitee.com
如图结果表示添加操作成功。
最后在试试拉取一下代码是不是就成功了。