fatal: unable to connect to github.com: github.com[0: 140.82.121.3]: errno=Operation timed out
Asked Answered
C

5

23

I try to push my project and it shows me this in the terminal (I use MacOS): fatal: unable to connect to github.com: github.com[0: 140.82.121.3]: errno=Operation timed out

I tried to clone a project and it showed me that, then I tried to push one in my personal GitHub and it showed it again. Before trying to clone the project it worked well. Idk why is this happening.

joanskenderi@joans-mbp Course Goals App % git push origin master
fatal: unable to connect to github.com:
github.com[0: 140.82.121.3]: errno=Operation timed out

joanskenderi@joans-mbp Course Goals App % git remote -v
origin  git://github.com/joanskenderi/Course-Goals-App.git (fetch)
origin  git://github.com/joanskenderi/Course-Goals-App.git (push)
joanskenderi@joans-mbp Course Goals App %   
Cleopatracleopatre answered 8/7, 2022 at 18:46 Comment(2)
Can you edit your question to include a code block with the output of git remote -v?Kingwood
I think I did it. @KingwoodCleopatracleopatre
K
39

The problem here is that you're using the unauthenticated Git protocol on port 9418 (that can be seen with git://). GitHub turned that off sometime back because it's unencrypted and can be tampered with by pretty much anybody.

Even when it was supported on GitHub, you were never able to push with it because there was no way to authenticate.

You need to change the remote URL to either HTTPS or SSH, like so:

$ git remote set-url origin https://github.com/joanskenderi/Course-Goals-App.git
# or
$ git remote set-url origin ssh://github.com/joanskenderi/Course-Goals-App.git

It's best to use the one for which you already have credentials (either a personal access token or an SSH key) set up.

Kingwood answered 8/7, 2022 at 20:14 Comment(0)
L
17

The problem was the git port is restricted.

I fixed this with:

git config --global url."https://".insteadOf git://
Loquitur answered 26/7, 2023 at 9:39 Comment(0)
B
0

I was having the same error. Following the first answer from @bk2204, this worked for me:

$ sudo git clone https://github.com/joanskenderi/Course-Goals-App.git
Brewer answered 16/6, 2023 at 11:24 Comment(1)
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From ReviewIlliterate
C
0

Use url in .submodule file in this format:

[submodule "submodule-name"]
    path = my-folder
    url = [email protected]:My-User/my-repo.git

Don't forget to:

git submodule sync 
git submodule update

Works well for me. But I'd avoid submodules in general ;)

Chadchadabe answered 17/1 at 8:0 Comment(0)
P
-1

Yeah Using https:// protocol instead of git worked for me.

Patsypatt answered 16/1 at 2:13 Comment(1)
This answer has already been given. Do not repeat existing answers.Hadlee

© 2022 - 2024 — McMap. All rights reserved.