Ahmed Elshafei
Ahmed Elshafei

Reputation: 915

Reset git proxy to default configuration

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?

Upvotes: 89

Views: 155119

Answers (8)

Minato
Minato

Reputation: 1

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

Upvotes: 0

rjdkolb
rjdkolb

Reputation: 11888

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=""

Upvotes: 21

Rahul Gul
Rahul Gul

Reputation: 582

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)

Upvotes: 0

sramij
sramij

Reputation: 4925

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

Upvotes: 177

RobsionKarls
RobsionKarls

Reputation: 136

git config --global --unset http.proxy

Upvotes: 6

user2903536
user2903536

Reputation: 1812

Remove both http and https setting by using commands.

git config --global --unset http.proxy

git config --global --unset https.proxy

Upvotes: 12

Rajan
Rajan

Reputation: 1511

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.

Upvotes: 23

Mark Longair
Mark Longair

Reputation: 467851

You can remove that configuration with:

git config --global --unset core.gitproxy

Upvotes: 94

Related Questions