Set Git proxy

I was using ssh to clone a repo from Github on wsl, and http proxy not work.

Work with ssh config

edit file ~/.ssh/config

1
2
3
4
5
Host github.com
Hostname github.com
ServerAliveInterval 55
ForwardAgent yes
ProxyCommand nc -x 127.0.0.1:7890 %h %p

Work with http/https

update ~/.gitconfig

1
2
3
4
5
[http]
[http "https://github.com"]
proxy = http://proxyUsername:[email protected]:port
sslVerify = false
sslVerify setting is not necessary.

Notes:
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

作者

Ginta

发布于

2024-01-23

更新于

2024-01-23

许可协议

评论