89

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?

DdW
  • 890
  • 1
  • 18
  • 30
Ahmed Elshafei
  • 915
  • 1
  • 7
  • 8

8 Answers8

175

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

msanford
  • 11,803
  • 11
  • 66
  • 93
sramij
  • 4,775
  • 5
  • 33
  • 55
  • 5
    and for https use git config --global --unset https.proxy – Abhishek Dhote Dec 23 '14 at 06:02
  • 2
    One annoying thing with `--unset` is that it leaves the section heading, so you can end up with multiple empty `[http]` sections polluting your `.gitconfig`. Use `config --global --remove-section http` to remove the entire `[http]` section including the heading. – thdoan Nov 09 '16 at 14:19
94

You can remove that configuration with:

git config --global --unset core.gitproxy
Mark Longair
  • 446,582
  • 72
  • 411
  • 327
23

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.

Rajan
  • 1,501
  • 4
  • 21
  • 37
20

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=""
rjdkolb
  • 10,377
  • 11
  • 69
  • 89
12

Remove both http and https setting by using commands.

git config --global --unset http.proxy

git config --global --unset https.proxy

wogsland
  • 9,106
  • 19
  • 57
  • 93
user2903536
  • 1,716
  • 18
  • 25
6
git config --global --unset http.proxy
Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
RobsionKarls
  • 136
  • 1
  • 9
  • 2
    It appears this answer was provided by @sramij three years earlier. How is this answer different then sramij answer? Unfortunately, the only thing we can do at the moment is flag this answer as spam. Also see [New flag reason for “Pointless Answer” for “Me too” type answers](https://meta.serverfault.com/questions/1016/new-flag-reason-for-pointless-answer-for-me-too-type-answers). – jww Jun 24 '17 at 20:14
0

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)
0

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
Vega
  • 27,856
  • 27
  • 95
  • 103
Minato
  • 1
  • 1