git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Git doesn't honor NO_PROXY environment variable while cloning

From
Ondrej Pohorelsky <opohorel@redhat.com>
Date
Sep 11, 2020, 12:15 UTC
Message-ID
<CA+B51BGRuLfF7FpiK93Wih0XhsC7rJLGjkF2CzrEsUkBEif+jw@mail.gmail.com>
Hi,

we've got a bug[0] reported in Red Hat Bugzilla. It seems like Git doesn't honor NO_PROXY environment variable while cloning repositories

Reporter has provided these steps to reproduce using Git version 2.18.4:
1. Start a ubi8 container with podman:
```
$ podman run --rm -it registry.access.redhat.com/ubi8/ubi /bin/bash
```
2. Install git in the container - `# yum install -y git`
3. Add "bad" _PROXY environment variables:
```
# export HTTP_PROXY=http://user:pass@bad.proxy
# export HTTPS_PROXY=https://user:pass@bad.proxy
```
4. Add Github as an ignorable proxy domain:
```
# export NO_PROXY=github.com
```
5. Clone a github repo:
```
# mkdir -p /tmp/clone-test
# cd /tmp/clone-test
# git clone https://github.com/sclorg/nodejs-ex.git
# echo $?
```

Actual results: ``` # git clone https://github.com/sclorg/nodejs-ex.git Cloning into 'nodejs-ex'... # echo $? 128 ```

Expected results:
Git clone succeeds, bypassing the proxy.

However I've found out that this possible issue is present even in newer versions e.g. 2.28.0.

There is a workaround. You can rewrite proxy to be blank in .gitconfig
for specific websites.
```
[http "https://github.com/"]
        proxy = ""
```

Is this an issue or expected behaviour? And if it is expected behaviour, then why?

Best regards, Ondřej Pohořelský

[0]https://bugzilla.redhat.com/show_bug.cgi?id=1875639
Next: Jeff King
Message 1 of 6 in “Git doesn't honor NO_PROXY environment variable while cloning”
  1. Ondrej PohorelskySep 11, 2020
  2. Jeff KingSep 11, 2020
  3. Daniel StenbergSep 11, 2020
  4. Jeff KingSep 11, 2020
  5. Junio C HamanoSep 11, 2020
  6. Jeff KingSep 11, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.