Reset git proxy to default configuration

Git

Git Problem Overview


I installed Socat to use the Git Protocol Through a HTTP CONNECT Proxy, then I create a script called gitproxy in your bin directory.

#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.
#
# Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
# chmod +x gitproxy
# git config --global core.gitproxy gitproxy
#
# More details at https://www.emilsit.net/blog/archives/how-to-use-the-git-protocol-through-a-http-connect-proxy/

# Configuration. Common proxy ports are 3128, 8123, 8000.
_proxy=proxy.yourcompany.com
_proxyport=3128

exec socat STDIO PROXY:$_proxy:$1:$2,proxyport=$_proxyport

then I configured git to use it:

$ git config --global core.gitproxy gitproxy

Now I want to reset git to the default proxy configurations, how can I do that?

Git Solutions


Solution 1 - Git

For me, I had to add:

git config --global --unset http.proxy

Basically, you can run:

git config --global -l 

to get the list of all proxy defined, and then use "--unset" to disable them

Solution 2 - Git

You can remove that configuration with:

git config --global --unset core.gitproxy

Solution 3 - Git

Edit .gitconfig file (Probably in your home directory of the user ~) and change the http and https proxy fields to space only

[http]
	proxy = 
[https]
	proxy = 

That worked for me in the windows.

Solution 4 - Git

On my Linux machine :

git config --system --get https.proxy (returns nothing)
git config --global --get https.proxy (returns nothing)

git config --system --get http.proxy (returns nothing)
git config --global --get http.proxy (returns nothing)

I found out my https_proxy and http_proxy are set, so I just unset them.

unset https_proxy
unset http_proxy

On my Windows machine :

set https_proxy=""
set http_proxy=""

Optionally use setx to set environment variables permanently on Windows and set system environment using "/m"

setx https_proxy=""
setx http_proxy=""

Solution 5 - Git

Remove both http and https setting by using commands.

git config --global --unset http.proxy

git config --global --unset https.proxy

Solution 6 - Git

git config --global --unset http.proxy

Solution 7 - Git

If you have used Powershell commands to set the Proxy on windows machine doing the below helped me.

To unset the proxy use:

  1. Open powershell

  2. Enter the following:

    [Environment]::SetEnvironmentVariable(“HTTP_PROXY”, $null, [EnvironmentVariableTarget]::Machine) [Environment]::SetEnvironmentVariable(“HTTPS_PROXY”, $null, [EnvironmentVariableTarget]::Machine)

To set the proxy again use:

  1. Open powershell

  2. Enter the following:

    [Environment]::SetEnvironmentVariable(“HTTP_PROXY”, “http://yourproxy.com:yourportnumber”, [EnvironmentVariableTarget]::Machine) [Environment]::SetEnvironmentVariable(“HTTPS_PROXY”, “http://yourproxy.com:yourportnumber”, [EnvironmentVariableTarget]::Machine)

Solution 8 - Git

If running

git config --global --unset http.proxy

gives a warning:

> http.proxy has multiple values

and none of the proxies are removed, then add "-all" in the command:

git config --global --unset-all http.proxy

to successfully remove all proxies.

You can check it with:

git config --global --list

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAhmed ElshafeiView Question on Stackoverflow
Solution 1 - GitsramijView Answer on Stackoverflow
Solution 2 - GitMark LongairView Answer on Stackoverflow
Solution 3 - GitRajanView Answer on Stackoverflow
Solution 4 - GitrjdkolbView Answer on Stackoverflow
Solution 5 - Gituser2903536View Answer on Stackoverflow
Solution 6 - GitRobsionKarlsView Answer on Stackoverflow
Solution 7 - GitRahul kalivaradarajaluView Answer on Stackoverflow
Solution 8 - GitMinatoView Answer on Stackoverflow