getting-started-with-javascript
getting-started-with-javascript copied to clipboard
在同步仓库git fetch upstream master时出现错误提示Operation timed out及解决方法
碰到一个问题
仓库同步时出错
按照 @Dream4ever 同学的《Git常用操作笔记》文档里面的提示操作,将自己的仓库和老师的仓库同步。在执行:
git fetch upstream master
出现以下错误提示:
git fetch upstream master
fatal: unable to access 'https://github.com/xugy0926/getting-started-with-javascript.git/': Failed to connect to github.com port 1080: Operation timed out
✘ antarts@wukuipindeMacBook-Pro ⮀ ~/javascriptbridge/getting-started-with-javascript ⮀ ⭠ lesson3_homework_wukuipin ⮀ git remote -v
origin [email protected]:antarts/getting-started-with-javascript.git (fetch)
origin [email protected]:antarts/getting-started-with-javascript.git (push)
upstream https://github.com/xugy0926/getting-started-with-javascript.git (fetch)
upstream https://github.com/xugy0926/getting-started-with-javascript.git (push)

解决办法
- 在终端执行:
git remote rm upstream
- 将 https:// 更换为 git@ ,同样终端执行:
it remote add upstream [email protected]:xugy0926/getting-started-with-javascript.git
- 然后再按照《Git常用操作笔记》往下操作即可。
这是我更换后,成功同步的画面:

总结
对于出现这个问题的原因不是很了解,似乎是代理的问题。希望这能帮助到遇到同样问题的同学!
有时候网络不好,就会这样,可以先去忙别的事情,过一会儿再试试。
@Dream4ever 我是把仓库地址上的 https:// 换成 git@ 才成功,也不知道为什么😂
@antarts 能从不同的角度去尝试,很好的思维方式啊,加油~~~
一般都是网络问题。此时,你可以用ping指令来测试一下目标url