1

I have been having a problem with my git in so long, i have tried everything i could and it din't change anything. My git works well locally, it works with init, commits, etc. The problem is when i go to make whatever with github, since making a git clone, or git push It doesn't work with either github CLI or Git Bash, or cmd. Any of those commands i put in, just yield the following error:

fatal: unable to connect to github.com
github.com[0: 140.82.114.4]: errno=Unknown error

failed to run git: exit status 128

I've been trying with some internet solution perspectives:

  • This 26 upvoted answer
  • All this solutions about geting free port 9418, Trying with Https protocol, switching among ssh and https
  • I revised host file in C:\Windows\System32\drivers\etc location for local DNS possible incorrect configuration
  • I reinstalled Git
  • I search for some network problems, and i have got ping from github.com server and tracert github.com command for viewing github request trace and it works good as well.
  • I try using the following culr command to download the main branch zip file, through cmd and it WORKED, downloading the zip file!!!:
curl https://github.com/user/repo.git | git clone url:-

(of course, replacing my user and repo names)

  • I configured git own proxy settings to unset:
git config --global --unset http.proxy
  • I made github test for conection, obtaining good results against all servers ip and all other testing things.

I think that the problem is a git configuration realated with port or network, but i don't find it

FrankAyra
  • 46
  • 5

2 Answers2

1

The first thing to check is the remote URL used for your repository.

Even without cloning, you can test the connectivity with:

# HTTP URL:
git ls-remote https://github.com/me/myrepo

# SSH URL:
git ls-remote git@github.com/me/myrepo

If one of them is working, use it to clone the repository.

Check also:

  • for any environment variable related to Git or curl (type set in a CMD)
  • for any proxy setting (again: set|grep -i proxy)
  • for any PATH issue (try a simplified PATH in a CMD for testing)
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

i solved the problem, i tried this solution but in other way. Adding this manually to the .gitconfig file, located within %USERPROFILE% directory:

[url "https://"]
    insteadOf = ssh://
    insteadOf = git://

because with the cmd commands:

git config --global url."https://".insteadOf git://
git config --global url."https://".insteadOf ssh://

it was not setting up the configuration correctly.

I think what was happening is that git was trying to access GitHub via ssh and the port used for that protocol is 9418, which seemed to be blocked somehow. I discovered that using netstat tool from cmd which showed me the SYN_SEND state of the requests when i tried to do git ls-remote. It is a patch solution, but it fixed it :(

FrankAyra
  • 46
  • 5
  • 1
    Good catch, I see `git ls-remote` was useful. – VonC Apr 13 '23 at 02:45
  • yes it was, thank you so much, I have learnt a lot since I came to this site, everyday... beacuse of the vast knowledge here. Appreciate it and Thanks again!! – FrankAyra Apr 13 '23 at 04:45