参考

git使用代理clone

git clone 时Failed to connect to github.com port 443:connection timed out 怎么办

问题

执行git clone 无法连接

1
2
3
$ git clone https://github.com/techniquenotes/School_Resources.git
Cloning into 'School_Resources'...
fatal: unable to access 'https://github.com/techniquenotes/School_Resources.git/': Failed to connect to github.com port 443 after 21071 ms: Couldn't connect to server

解决

执行

1
2
3
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080
// 打开代理设置,查看端口

成功克隆

1
2
3
4
5
6
7
$ git clone https://github.com/techniquenotes/School_Resources.git
Cloning into 'School_Resources'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (4/4), 4.51 KiB | 4.51 MiB/s, done.

关闭代理

1
2
git config --global --unset http.proxy
git config --global --unset https.proxy