I'm behind a proxy in Windows 10 (and in Windows 11), git 2.32.0.window.1
. This is what worked for me.
Checking What You Have
Check your global configurations using:
git config --global --list
You should see the settings for user.name
, user.mail
, etc. Having the following lines in place fixed the problem for me:
http.proxyauthmethod=basic
http.proxy=http://username:password@proxyaddress:port
https.proxy=https://username:password@proxyaddress:port
Notice these are settings for both HTTP and HTTPS protocols. If you don't see both, you'll have to set them.
Setting The Proxy
Use this line of code in your console, for both protocols:
git config --global https.proxy https://username:password@proxyaddress:port
And, if necessary:
git config --global http.proxy http://username:password@proxyaddress:port`
If you don't know what the proxy and ports are, look for Internet Options (or properties) window menu in your Windows system (Control Panel).
Internet Properties (window) → Connections (tab) → LAN Settings (button) → Proxy Server (section) → Advanced (button)
And, remember to replace all values (id est: username
, password
, proxyaddress
, and port
) with the actual ones (in proxyaddress
you'll have to set up an IP address).
Keep in mind that you may need to leave some of those values empties (because they are not required by your proxy). For example, one time I had to set:
git config --global http.proxy http://:@10.1.33.244:81
As you may noticed, no user name or password were needed.
Useful Bash script
Since I have to set and unset the proxy configuration of my system on a daily basis, I've made this little script you main find useful: Gist
Note
If you need to access GitLab, you may need to follow these steps after the ones I've just described: GitLab authentication requires tokens
When you try to clone the repository, you'll be prompted for your GitLab username and password. Instead of entering your regular password, you need to provide a generated token instead. The username is the same.