Git proxy bypass

GitHttpProxy

Git Problem Overview


Git works in a proxied environment by setting the http.proxy configuration parameter.

For certain addresses I need to bypass the proxy. Is there a no-proxy/bypass-proxy configuration parameter?

Git Solutions


Solution 1 - Git

The proxy can be overridden on a per-remote basis - see http://git-scm.com/docs/git-config (look for the "http.proxy" and "remote.<name>.proxy" settings). Assuming you have the remote called "origin" then the command you could use to bypass proxy for this remote is:

git config --add remote.origin.proxy ""

Solution 2 - Git

To bypass proxy for certain, usually a local address, all you need to do is:

export no_proxy=URLToIgnore

Where URLToIgnore is the URL that you want Git to ignore. You can also ignore URLs ending with a certain word.

export no_proxy=.mylocal

Where all urls ending with .mylocal will get ignored. To ignore multiple URLs:

export no_proxy=.mylocal URLToIgnore

To make it permanent, add it to your ~/username/.bash_profile file. If you cannot find .bash_profile file in your user root directory, then manually create it.

For more details: https://stackoverflow.com/questions/19523903/how-to-temporarily-disable-git-http-proxy

Solution 3 - Git

Make sure you have a Git 2.1.2+ if you want to set a config to an empty value, like

git config --add remote.origin.proxy ""

Because if you decide to restore a proxy for that remote (here 'origin')... it will segfault with a Git older than 2.1.2 (Sept. 30th, 2014)

See commit c846664 (tanayabh)

make config --add behave correctly for empty and NULL values

> Currently if we have a config file like,

[foo]
        baz
        bar =

> and we try something like, "git config --add foo.baz roll", Git will segfault. Moreover, for "git config --add foo.bar roll", it will overwrite the original value instead of appending after the existing empty value.

> The problem lies with the regexp used for simulating --add in git_config_set_multivar_in_file(), "^$", which in ideal case should not match with any string but is true for empty strings.
Instead use a regexp like "a^" which can not be true for any string, empty or not.

> For removing the segfault add a check for NULL values in matches() in config.c.

Solution 4 - Git

For Windows users

Accepted answer requires the git repo to exist before hand to work and the second best answer works only for linux & Mac. So in windows to make it work for https://git-url.com/project/repo-name.git try the following in a command prompt

set no_proxy=git-url.com

then

git clone git-url.com/repo-name.git

Now you will have a repo to apply the accepted answer.

Solution 5 - Git

Assuming you are starting by cloning, the origin-config things are not so useful. When I find myself in that position I do.

$> no_proxy=$no_proxy,<git-url|ip> git clone ...

Note that this will be per command. To make this permanent for the repo just cloned, you can now go to the newly cloned repo and add the empty-proxy setting.

$> git config --add remote.origin.proxy ""

However, if you want this host or IP excluded from proxy in all cases, use your shells init-file to do the inclusion of your origins permanent for your user.

I would put the following line last in .bashrc

export no_proxy=$no_proxy,<your repo>

I hope that makes things clearer!

Solution 6 - Git

Due to Windows / Unix user role, if you can't eliminate the http_proxy from command line, please try this approach -

git config -l --show-origin

That will print the configurations based present on the files according to hierarchy. Now go to specific file (local .git/config folder file) and update / remove the http_proxy.

Hope this helps.

Solution 7 - Git

If you are trying to clone a new repo, some solutions given in other answers will fail, because git complains that the local folder contains no git repository.

In this case this worked for me

git config --global --add remote.origin.proxy ""

Solution 8 - Git

Old question but here is how to configure this globally:

  1. Set the proxy:
git config --global http.proxy proxy.example.com:3128
  1. Turn off the proxy for specific URLs by setting the their proxy to the empty string (replace myserver.localdomain with your server FQDN):
git config --global http.https://myserver.localdomain.proxy ''

Solution 9 - Git

just execute below command on command prompt

git config --global http.proxy [Proxy IP]:[Proxy port]

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
QuestionyannisfView Question on Stackoverflow
Solution 1 - GitJan GutvirthView Answer on Stackoverflow
Solution 2 - GitYas TabasamView Answer on Stackoverflow
Solution 3 - GitVonCView Answer on Stackoverflow
Solution 4 - GitGanesh PendyalaView Answer on Stackoverflow
Solution 5 - GitOriginalHackerView Answer on Stackoverflow
Solution 6 - GitRiddhi SanyalView Answer on Stackoverflow
Solution 7 - Gitdaniel spView Answer on Stackoverflow
Solution 8 - GitChristoView Answer on Stackoverflow
Solution 9 - GitDheeraj PureView Answer on Stackoverflow