Skip to content

GitClone报错问题解决

· 1 min · Git / Shell / 问题解决

问题描述#

执行命令如下

Terminal window
git clone git://github.com/jiangmiao/auto-pairs.git ~/.vim/bundle/auto-pairs

详细报错如下

Terminal window
fatal: unable to connect to github.com:
github.com[0: 20.205.243.166]: errno=Connection timed out

发现这是因为使用了git://**导致的错误,更深的原因并不清楚,这里发现只要改用https就可以解决问题。

问题解决#

执行以下代码

Terminal window
git config --global url.https://github.com/.insteadOf git://github.com/
git config --global url."https://".insteadOf git://

这些命令将向**.gitconfig**的配置文件下写入替代git://为https:// 的规则。

同理也可以直接向配置文件写入对应的规则。