首页 >
文章 >
杂文
git Permission denied (publickey). fatal: Could not read from remote repository
时间:2018-02-28 15:32:22 点击: 来源: 作者:
从git拉取代码出错:
Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
原因:未添加自己主机 ...
从
git拉取代码出错:Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
原因:未添加自己主机的公钥到git,添加即可。
1.在本地要拉取的机器上t生成秘钥(以我的cnetos7为例):
cd ~/.sshssh-keygen -t rsa #按3次回车
cat id_rsa.pub #查看公钥代码并复制。
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+ttxGK1g+auNIXZFWlRRNBNQqfMazUsu6KaOp5cz+E31a/QzFBnm1wbTIxToUafBbSEgZcq4p6te505+Rcw3ZMkVjth/oFhAdYQ4r45KNbAhTbOmvsn78gLjpPWCVPwKKgaWRX5EBeIs2+80tTMs74PmFtcZ8vS4gpieHz1fLQha7SZxbJo12LzljL+UxA8lHM7UsZR2vdtnQsyPoS62nNEmobKUGCJLTdZ+8FuTu0QKFsmX7NF8MN0WNcoDVEZwN2AxROTcDNixTstCIpSj9fiPddQgYpubtUvrSpNC5ddavlRhWdegGzWcC9nFYZblYYF1uwD7NNpO8Hs5u98uHv3 root@localhost.localdomai
2.登陆自己的gitzhang账号,单击右上角设置:
点击“
New SSH key”,新建一个ssh,并粘贴自己主机公钥进去:
重新拉取文件即可。
”您可通过以下微信二维码,赞赏作者“