git Permission denied (publickey). fatal: Could not read from remote repository
2018-02-28 15:32:22   来源:   评论:0 点击: 收藏

从git拉取代码出错:Permission denied (publickey) fatal: Could not read from remote repository Please make sure you
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 ~/.ssh
ssh-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,并粘贴自己主机公钥进去:


重新拉取文件即可。

相关热词搜索:git Permission denied

上一篇:如何优雅地写一个Mesos Framework
下一篇:pure-ftpd安装