To configure Git to use a SOCKS proxy, you use the http.proxy
and https.proxy
configuration options. Here is how you can do it:
- Open Terminal.
- Type in the following command to set the HTTP proxy:
git config --global http.proxy 'socks5://127.0.0.1:1080'
In this command, 127.0.0.1
is the local IP address and 1080
is the port number. Replace these with your SOCKS proxy’s IP address and port number.
- Type in the following command to set the HTTPS proxy:
git config --global https.proxy 'socks5://127.0.0.1:1080'
Again, replace 127.0.0.1
and 1080
with your SOCKS proxy’s IP address and port number.
- You can check your configuration changes by typing:
git config --global --get http.proxy
git config --global --get https.proxy
These commands should return the SOCKS proxy settings that you just entered.
- If you want to unset or remove the proxy settings, you can do so by typing:
git config --global --unset http.proxy
git config --global --unset https.proxy