There are several ways to clone a repository from github. Similar from other providers, such as bitbucket, gitlab, etc.
https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols
Mostly, we use
- http
- ssh
The clone command with protocol https
git clone https://github.com/kubernetes/kubernetes.git
The clone command with protocol ssh+git
git clone [email protected]:kubernetes/kubernetes.git
So I have to set ssh config (~/ssh/config
) with ProxyCommand
properly, git clone start working with proxy.
Install corkscrew
or other proxy tool first.
set ssh config
Host github.com
Hostname github.com
ServerAliveInterval 55
ForwardAgent yes
ProxyCommand /usr/bin/corkscrew <replace_with_your_company_proxy_server> <3128> %h %p
ProxyCommand /usr/bin/nc -x 127.0.0.1:7890 %h %p
cat ~/.ssh/myauth
proxyUsername:proxyPassword
set ssh config
Host github.com
Hostname github.com
ServerAliveInterval 55
ForwardAgent yes
ProxyCommand /usr/bin/corkscrew <replace_with_your_company_proxy_server> <3128> %h %p ~/.ssh/myauth
update ~/.gitconfig
[http]
[http "https://github.com"]
proxy = http://proxyUsername:[email protected]:port
sslVerify = false
sslVerify
setting is not necessary.
If you only need access github by the way of ssh+git
, you needn't set any proxy in ~/.gitconfig
and run git config --global http.proxy ...
and similar commands at all