linux - 我的 vps 上的 git 与 CentOS 7.0 权限被拒绝(公钥)。每次都是致命的 : Could not read from remote repository.

标签 linux git ssh centos7

当我登录到我的服务器并执行 git pull
我得到:

no such identity: /home/admin/.ssh/gitHubKey: No such file or directory
no such identity: /home/admin/.ssh/id_rsa_buhlServer: No such file or directory
Permission denied (publickey).

我必须执行这2个命令:

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa

它一直有效,直到我注销并再次登录。

注意:我已经生成了 ssh-rsa并将其保存为新的 ssh key 。

最佳答案

删除

IdentityFile ~/.ssh/gitHubKey
IdentityFile ~/.ssh/id_rsa_buhlServer

来自~/.ssh/config并仅添加到那里

`IdentityFile ~/.ssh/id_rsa`

如果这不是共享帐户,并且其他人可以使用其他选项。

它应该可以完成这项工作。

关于linux - 我的 vps 上的 git 与 CentOS 7.0 权限被拒绝(公钥)。每次都是致命的 : Could not read from remote repository.,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42679171/

相关文章:

linux - 用户目录 "End of script output before headers"中的 Apache CGI

每次保存文件时执行的 linux(和 OSX)shell 命令

git - 如何在 git 存储库中使用 "artificial root commit"?

security - 将 JMX 限制到本地主机

bash - 没有欢迎横幅的ssh登录

java - 如何在 Raspberry Pi(Rip) 上部署一个 war 文件?

linux - 我的环境变量对系统上的其他用户安全吗?

Git 添加错误 - 未知开关

用于在两台计算机之间进行备份和同步的 git 设置

linux - 从 cron 调用时脚本不起作用