
因为不可抗拒的原因,在乌鲁木齐从 github 上面克隆项目时,会超时克隆不了。
使用 https 方式报错:
$ git clone https://github.com/xxx.git
Cloning into 'xxx'...
fatal: unable to access 'https://github.com/xxx.git/': Failed to connect to github.com port : Timed out
使用 ssh 方式报错:
$ git clone git@github.com:xxx.git
Cloning into 'xxx'...
ssh: connect to host github.com port : Connection timed out
fatal: Could not read from remote repository. Please make sure you have the correct access rights
and the repository exists.
场景:使用 vpn
github 可以正常访问,git clone 运行超时
解决方法:
1. 配置 git 的代理
git config --global http.proxy "127.0.0.1:1080"
git config --global https.proxy "127.0.0.1:1080"
这里是关键:需要本地启动 vpn
2. 使用 https 方式 clone
$ git clone https://github.com/xxx.git
注意:这里必须使用 https 方式, ssh 方式即使配置了 git 的代理也不好使。。。
吐槽:
也不知道屏蔽个 github 干嘛,前阶段 **** 也屏蔽了,不过还好最近放开了。