I am inside a corporate network that requires a proxy to be set up to access servers outside the intranet.
So, to be able to git clone
from, say, github we have set up the HTTP_PROXY
environment variable. That works fine.
However, we also have an internal git server. To properly access that we must not use the proxy. It works if I set this up in the .gitconfig
file:
[http "http://stash.fabricam.com/"]
proxy =
Since the proxy is set to the empty value here, no proxy is used for git clone
from the server in question.
However, I would like to be able to create this configuration in a script, using git config --global
. But I can't figure out how to do it.
These do not work
git config --global http.http://stash.fabricam.com/ ""
git config --global http.http%3A%2F%2Fstash.fabricam.com%2F ""
git config --global http.http%3A%2F%2Fstash.fabricam.com%2F ''
git config --global --add http.http%3A%2F%2Fstash.fabricam.com%2F
As you can see I have tried to use the percent encoding, but that does not help.
I have read this post, but I don't want to set this on every command, I really want to modify the .gitconfig
file.
I have attempted setting up the no_proxy
environment variable, but git
does not seem to notice it.
I am in a Windows environment, running git 2.7.1
edit
Thanks to @choroba I got a bit further.
The behavior of this command is different depending on the shell:
git config --global http."http://stash.fabricam.com/".proxy ''
In
PowerShell
, this does nothing at all.In
cmd.exe
it creates this setting
[http "http://stash.fabricam.com/"]
proxy = ''
But that does not work. The empty string is not the same as no string at all. It will result in this behavior:
> git clone http://stash.fabricam.com/test.git
Cloning into 'test'...
fatal: unable to access 'http://stash.fabricam.com/test.git/':
Couldn't resolve proxy ''''
- In
bash
(that comes with git on windows) the command does work, and sets up the correct empty value. But I'd rather not script in bash when on windows, so this is not a good solution for me.