【发布时间】:2016-11-03 00:18:49
【问题描述】:
我在我们组织下的 github 上创建了一个新用户,将用于自动部署。我关注了https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/#platform-linux上的文章。
不知何故,当我尝试将存储库克隆到服务器时,它工作了一次。代码运行正常,我退出服务器。今天,我们发布了代码更新,我想手动将代码部署到服务器,所以我 ssh 到服务器并尝试使用git pull 拉取存储库。它给了我 Permission denied 错误。经过一些调试后,我意识到 ssh-agent 没有运行。所以我执行了以下命令:
eval "$(ssh-agent -s)"
ssh-add .ssh/id_rsa_staging
现在,当我尝试ssh -T git@github.com 时,我看到了欢迎消息:
Hi *****! You've successfully authenticated, but GitHub does not provide shell access.
但是当我尝试从存储库中提取时,我不断收到以下错误消息:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我检查了存储库,用户对它有 read 访问权限。我仔细检查了 github 和服务器上的密钥是否匹配,是的。我尝试生成新密钥。我尝试使用 ssh/config 文件。没有任何帮助...
感谢任何帮助和建议!
更新:
所以我发现git clone 命令工作正常,但即使我在 git clone 之后尝试git pull,它也会给出错误。
【问题讨论】:
标签: linux git ubuntu github ssh