2

I work in a bank which seems to be blocking Github (they use with internally hosted repos):

H:\>git clone https://github.com/torvalds/linux.git
Cloning into 'linux'...
fatal: unable to access 'https://github.com/torvalds/linux.git/': 
Could not resolve host: github.com

However, I'm able to access https://github.com/torvalds/linux through the web browser.

How did the company manage to block https://github.com/torvalds/linux.git but not https://github.com/torvalds/linux?

Is there any way I can get around it? I tried git init and manually adding the remote url, but git pull still gives the same error as above.

2
  • They haven't, you just haven't told git about your companys proxy. Commented May 25, 2018 at 13:42
  • As previous comment says, your proxy needs your username and password which the browser sends but git does not. Did you solve this? Commented Sep 20, 2018 at 7:09

2 Answers 2

3

Presuming you're doing this on windows, or have access to a windows machine to check the proxy settings, linux users you're on your own! ;)

Command to use:

git config --global http.proxy http://proxyuser:[email protected]:8080
  • change proxyuser to your proxy user
  • change proxypwd to your proxy password
  • change proxy.server.com to the URL of your proxy server
  • change 8080 to the proxy port configured on your proxy server

If your proxy doesn't require logging in, use

git config --global http.proxy http://proxy.server.com:8080

How do you find your proxy details? Well it varies depending how the proxy is setup, but you may find it in the system settings.

First, windows key + x,

  • Click Settings,
  • Click Network & Internet,
  • Click Proxy....
4
  • It's using an "automatic configuration script" for the proxy, and the script returns multiple proxies: "PROXY proxy-vip.web.**.com:PORT_NUM;PROXY cdc-proxy-vip.web.**.com:PORT_NUM". How should I configure multiple proxies or do I just need one? Should I configure https.proxy instead? How do I get the proxy user and password? (it's not in the script) I tried with my Windows login credentials, it failed with http code 407.
    – Avery235
    Commented May 28, 2018 at 6:26
  • If no username is shown in the script then you likely don't need one. I'd suggest just trying with one proxy - I've not dealt with a script that contains two before. Also should of said this before, maybe ask your IT team? Commented May 28, 2018 at 9:16
  • I got an error "Received HTTP Code 407 from proxy after CONNECT" without credentials. I don't want to ask the tech support because I'm not sure if use of Git is permitted, so I can claim ignorance if I get it to work myself and get found out.
    – Avery235
    Commented May 31, 2018 at 3:34
  • But doesn’t this store both username and password in the git config file as clear text? Are there any alternatives? Commented Sep 20, 2018 at 7:07
1

Or unset proxies

git config --global --unset https.proxy
git config --global --unset http.proxy

Or do you have the proxy in the local config?

git config --unset http.proxy
git config --unset https.proxy
1
  • thank you so much! Commented May 3, 2023 at 18:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .