Created
January 26, 2024 14:48
-
-
Save cbdyzj/fcbe51e7425f8846de048b16c79d42eb to your computer and use it in GitHub Desktop.
Set proxy for Git
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
# Method 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" | |
# Method 2. git http + proxy shocks | |
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 | |
# Method 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 | |
# Method 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 | |
# See: https://stackoverflow.com/questions/58245255/how-to-force-git-to-use-socks-proxy-over-its-ssh-connection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment