2

Is there a way to exclude the default-configured http-proxy from beeing used when checking out from local(corporate-network) git repository?

We have a git repository that is only accessible when not using proxy within git. We need to access this via http.

My current .gitconfig looks like this:

[user]
    name = username
    email = username@corporate.net
[core]
    autocrlf = true
[http]
    proxy = http://proxy.corporate.net:8080

I want git to ignore proxy whenever i interact with repositories located at http://ourGitRepository.corporate.net for example.

4

In your .gitconfig file try: (sslVerify entirely optional, I had issues with MITM certs not validating so I left it false as a quick win albeit security dangerous)


[http]
    #sslVerify = false
    proxy = http://proxy.corporate.net:8080
[http "http://ourGitRepository.corporate.net/"]
    #sslVerify = false
    proxy = 

From v1.8.5 onwards ref: https://github.com/git/git/blob/bb80ee09974667a1db6bbc5e33574ed869b76a88/Documentation/RelNotes/1.8.5.txt#L69-L78

6
  • 1
    Thanks! This does indeed work very well. However. I'd question setting sslVerify = false. But very useful indeed! Feb 3 '16 at 16:03
  • Good point, just edited to make that clear. I had to sslVerify locally otherwise kept getting certificate errors due to MITM cert chain problems from memory.
    – Jafin
    Feb 3 '16 at 23:34
  • I got around the SSL issue by adding our corporate root certificates to the ca-bundle.crt file that is distributed with Git. We now have our own version of ca-bundle.crt with our certs and reference it by adding sslCAinfo = C:\\Path\\To\\My\\ca-bundle.crt. The same ca-bundle.crt is also used by npm as well. Feb 8 '16 at 19:01
  • Similar to provided answer, but explain on how to do that on command line instead of modifying the config files: codeclimber.net.nz/archive/2015/01/20/…
    – anre
    Sep 15 '16 at 16:34
  • @anre the link you suggested works only by doing the same operation on each and every clone. What is advised here is done once and applies to any clone, also when running the initial clone command and the cloned repository does not exist. Sep 6 '17 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.