Skip to content

Instantly share code, notes, and snippets.

@chenshengzhi
Last active April 13, 2024 09:40
Show Gist options
  • Star 70 You must be signed in to star a gist
  • Fork 18 You must be signed in to fork a gist
  • Save chenshengzhi/07e5177b1d97587d5ca0acc0487ad677 to your computer and use it in GitHub Desktop.
Save chenshengzhi/07e5177b1d97587d5ca0acc0487ad677 to your computer and use it in GitHub Desktop.
git ssh 代理设置

仅为 GitHub 设置代理

git 代理

设置 git config --global http.https://github.com.proxy socks5://127.0.0.1:1086
设置完成后, ~/.gitconfig 文件中会增加以下条目:

[http "https://github.com"]
    proxy = socks5://127.0.0.1:1086
ssh 代理

修改 ~/.ssh/config 文件

Host github.com
    User git
    ProxyCommand nc -v -x 127.0.0.1:1086 %h %p
@UshioA
Copy link

UshioA commented Apr 13, 2024

为gitlab配置类似的代理:

Host gitlab.com
	User git
	Port 443
	Hostname altssh.gitlab.com
	IdentityFile ~/.ssh/id_ed25519
	IdentitiesOnly yes
	ProxyCommand nc -X connect -x localhost:1080 %h %p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment