10

I am working from home and am trying to clone a repo from Github and am getting the following error:

git clone https://github.com/account/repo.git

Also tried

git clone git://github.com/account/repo.git

Error: Failed connect to github.com:443; No error while accessing https://github.com/account/repo/info/refs?service=git-upload-pac
fatal: HTTP request failed

I even tried to use SSH and this is what I get:

ssh: connect to host github.com port 22: Bad file number fatal: could not read from remote repository.

I was just able to clone it on my laptop so I know that I have the correct permissions, I just need help trying to figure out why this is happening on my desktop and it seems that all of the other suggestions don't seem to be working.

  • I am not using a proxy.
  • I cannot do pulls on other repos that already exist either.

EDIT Ok I ran the command suggested, here are the results:

$ ssh -i ~/.ssh/id_rsa -vvv git@github.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug2: ssh_connect: needpriv 0
debug1: Connecting to github.com [204.232.175.90] port 22.
debug1: connect to address 204.232.175.90 port 22: Not owner
ssh: connect to host github.com port 22: Bad file number

Any suggestions?

gregwhitworth
  • 2,136
  • 4
  • 22
  • 33

3 Answers3

4

I know this may be general but I decided I wanted to get this answered, so here is what I did and it is now working correctly:

  • Uninstalled ALL git clients through windows (I had a couple initially for testing)
  • Installed the basic git bash from git
  • Turned off smart screen and ensured firewall and defender were off (they were)

Tried it again and it now works. My best guess is there was a mis-configuration somewhere - probably a wrong key (not sure how that happened since I updated it). At any rate it is working. It's probably the nuclear option but I hope this helps someone else that runs into this.

gregwhitworth
  • 2,136
  • 4
  • 22
  • 33
  • Were firewall and denfender turned off when you originally encountered the problem >? It seems as if port 443 and port 22 were both blocked. See also http://stackoverflow.com/questions/7144811/git-ssh-error-connect-to-host-bad-file-number – Wade Williams Apr 20 '13 at 03:08
  • No, I wish though, it's the weirdest thing. even when checking with netstat the ports are not being used, no matter what I did. It's just a very finicky type of problem. I actually just had it happen again, changed nothing and restarted and it ended up working again. I'm thinking I may need to do a good cleaning. – gregwhitworth Apr 21 '13 at 03:16
  • when in doubt, throw it out... and restart from a fresh system/install. – Wade Williams May 28 '13 at 23:04
  • 1
    Too technical! Is there another alternative way to resolve this? Your answer might not be effective for everyone. Too long process when uninstalling. – David Dimalanta Jul 09 '13 at 03:03
3

I could resolve the 443 error by issuing this command :

git config --global http.proxy <proxyname:port>
sjas
  • 18,644
  • 14
  • 87
  • 92
dghadge
  • 39
  • 1
3

Usually this means that your network is protected by a proxy server. To config git to use proxy, use this command:

git config --global http.proxy <http[s]://userName:password@proxyaddress:port>

if the proxy server doesn't have username and passeord, use this command

git config --global http.proxy <proxyaddress:port>
Mahmood Dehghan
  • 7,761
  • 5
  • 54
  • 71