Agustin Luques

Git commands ignoring proxy on Windows

a logo

Today I had to configure some http and https proxies to access some client's repositories.

The commands I had to use are the followings:

git config --global http.proxy <proxy_url>
git config --global https.proxy <proxy_url>

After some coding, I decided to swap to another proyect and when I tried to push a commit an error ocurred.

fatal: unable to access 'https://gitlab.com/<other_repo>.git/': Could not resolve proxy: <proxy_url>

So, I did what every ordinary dev would do

git config http.proxy ""

No success.

Ordinary dev's second step: Google -> StackOverflow.

Recommended solutions:

set no_proxy=gitlab.com
git config --add remote.origin.proxy ""

No success (in windows).


After diging deeper, inspecting the global .gitconfig file, I found a workaround.

In the root of the no proxy project, you will find the .git folder. Inside it, there is a file called config. Just open it and add these lines:

[http]
        proxy =
[https]
        proxy =

Success.


Edit: if you just want to clone a repo when you have the proxy set, you don't have, ofc, the .git folder. So, the command to use is the following.

git -c http.proxy= clone <url>

instagram icon twitter icon linkedin icon github icon


Buy me a beer🍻

or

Invitame un café ☕️