Last active
March 27, 2023 06:21
-
-
Save hsiafan/b3ae7a0b8d101b846ec8a242a9aac0f3 to your computer and use it in GitHub Desktop.
git proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git 两种模式:SSH 、HTTP | |
# proxy 两种模式:SOCKS 、HTTP | |
# 两两组合,共 4 种设置,请按需正确配置: | |
# 1. git http + proxy http | |
git config --global http.proxy "http://127.0.0.1:1080" | |
git config --global https.proxy "http://127.0.0.1:1080" | |
# 2. git http + proxy socks | |
git config --global http.proxy "socks5://127.0.0.1:1080" | |
git config --global https.proxy "socks5://127.0.0.1:1080" | |
# to unset | |
git config --global --unset http.proxy | |
git config --global --unset https.proxy | |
# 3. git ssh + proxy http | |
vim ~/.ssh/config | |
Host github.com | |
HostName github.com | |
User git | |
ProxyCommand socat - PROXY:127.0.0.1:%h:%p,proxyport=1087 | |
# 4. git ssh + proxy socks | |
vim ~/.ssh/config | |
Host github.com | |
HostName github.com | |
User git | |
ProxyCommand nc -v -x 127.0.0.1:1080 %h %p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment