git pull 连接ssh失败

浏览:24日期:2023-09-17

问题描述

$ git pull project developssh: connect to host github.com port 22: Connection timed outfatal: Could not read from remote repository.

Please make sure you have the correct access rightsand the repository exists.

project中有代码更新,但是连接失败怎么解决,github中ssh码已经绑定。

问题解答

回答1:

首先确认是不是网络的问题,网络不好的话国内连Github会经常超时。

不是网络问题的话,如果安装了Github desktop可以先打开下,然后在git pull。

回答2:

github国内时常抽风,多试试就可以了。或者你可以购买VPN,挂VPN进行操作。

回答3:

官方帮助给的解决方式是使用 ssh 443端口:

1,先测试可用性

ssh -T -p 443 git@ssh.github.com

提示如下证明可用

Hi username! You’ve successfully authenticated, but GitHub does notprovide shell access.

2,然后编辑~/.ssh/config 文件,如果没有config文件的话就直接vim ~/.ssh/config加入如下内容

Host github.comHostname ssh.github.comPort 443

再次测试

ssh -T git@github.com

提示如下即可用

Hi username! You’ve successfully authenticated, but GitHub does not provide shell access.

3,参考github官方帮助:https://help.github.com/artic...

相关文章: