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