简体   繁体   English

Git一直无法从服务器的上游拉出

[英]Git keeps failing to pull from upstream on server

Whenever I ssh into my VPS I always have to run through a slew of commands in order to get my git repo to fetch changes from upstream. 每当我将Ssh放入VPS时,我总是必须经过一系列命令才能获取git repo以便从上游获取更改。 Sometimes I get lucky enough and it works. 有时我很幸运,它可以工作。 For the most part it gives me the not found error: 在大多数情况下,它给了我未发现的错误:

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I've added the following to the end of the .bashrc file on the machine: 我在计算机上的.bashrc文件的末尾添加了以下内容:

eval "$(ssh-agent)"
eval "ssh-add /home/deploy/.ssh/id_rsa3"

When I ssh in I see the following output in the shell: 当我使用ssh时,我在shell中看到以下输出:

Agent pid 7974
Identity added: /home/deploy/.ssh/id_rsa3 (/home/deploy/.ssh/id_rsa3)

The fingerprint for the public key for id_rsa3 matches the deploy key saved in the repo settings on Github. id_rsa3的公共密钥的指纹与保存在Github上的回购设置中的部署密钥匹配。 It never works unless I manually run the above commands. 除非我手动运行以上命令,否则它永远无法工作。 Why is that? 这是为什么?

Se up the configuration in ~/.ssh/config for you ssh to work with the key in non-standard location: ~/.ssh/config以便ssh在非标准位置使用密钥:

Host git-host-you-are-using-to-pull-from
  IdentityFile /home/deploy/.ssh/id_rsa3

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM