Skip to content

Instantly share code, notes, and snippets.

@godwinnnnn
Forked from chenshengzhi/git_ssh_proxy.md
Last active July 17, 2023 15:07
Show Gist options
  • Save godwinnnnn/e19ef12be450877283c08d3b03b43421 to your computer and use it in GitHub Desktop.
Save godwinnnnn/e19ef12be450877283c08d3b03b43421 to your computer and use it in GitHub Desktop.
git ssh 代理设置

仅为 GitHub 设置代理

git 代理

设置 git config --global http.https://git.521000.best.proxy socks5://127.0.0.1:1086 注意1086是代理端口

设置完成后, ~/.gitconfig 文件中会增加以下条目:

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

修改 ~/.ssh/config 文件

#注意10801是代理端口
ProxyCommand connect -S 127.0.0.1:10801 -a none %h %p

Host github.com
User git
Port 22
Hostname github.com
# 注意修改路径为你的路径
IdentityFile "C:\Users\One\.ssh\id_rsa"
TCPKeepAlive yes

Host ssh.github.com
User git
Port 443
Hostname ssh.github.com
# 注意修改路径为你的路径
IdentityFile "C:\Users\One\.ssh\id_rsa"
TCPKeepAlive yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment