set proxy for github
一、References
二、Set proxy
At first, you should select one protocol which you use github
such like:
http/https
when you clone by git clone https://github.com/xxx
ssh
when you clone by git clone git@github.com:xxx
2.1 set http proxy
if we select http protocol
git config --global http.proxy "http://127.0.0.1:8080"
git config --global https.proxy "http://127.0.0.1:8080"
or if we use socks5, should set
git config --global http.proxy "socks5://127.0.0.1:1080"
git config --global https.proxy "socks5://127.0.0.1:1080"
2.2 set ssh proxy
we should modify ssh config file (~/.ssh/config
)
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/github
# ProxyCommand socat - PROXY:127.0.0.1:%h:%p,proxyport=8080 # if use http
ProxyCommand nc -v -x 127.0.0.1:1080 %h %p
2.3 unset proxy
git config --global --unset http.proxy
git config --global --unset https.proxy