每当我进入我的VPS时,我总是需要运行一系列命令才能让我的git repo从上游获取更改。有时候我很幸运,而且很有效。在大多数情况下,它给了我未找到的错误:
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我已将以下内容添加到计算机上.bashrc
文件的末尾:
eval "$(ssh-agent)"
eval "ssh-add /home/deploy/.ssh/id_rsa3"
当我进入ssh时,我在shell中看到以下输出:
Agent pid 7974
Identity added: /home/deploy/.ssh/id_rsa3 (/home/deploy/.ssh/id_rsa3)
id_rsa3
的公钥指纹与Github上repo设置中保存的部署密钥相匹配。除非我手动运行上述命令,否则它永远不会工作。那是为什么?
答案 0 :(得分:4)
在~/.ssh/config
中为您ssh
设置配置,以便在非标准位置使用密钥:
Host git-host-you-are-using-to-pull-from
IdentityFile /home/deploy/.ssh/id_rsa3