简体   繁体   中英

ssh: connect to host gist.github.com port 22: Operation timed out fatal: Could not read from remote repository

I am trying to push some code to a gist. I know there are a lot of other people with similar issues, and I have looked at all of the other posts I can find and they don't seem to address my problem.

➜  streamgraph git:(master) git push
ssh: connect to host gist.github.com port 22: Operation timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The majority of people are suggesting it is a problem with the ssh. However I went through a lengthy process of making sure my ssh keys were updated and I get this message when I test out the ssh, which as far as I understand means there isn't a problem with my ssh setup.

➜  streamgraph git:(master) ssh -T git@github.com
Hi adrianturcato! You've successfully authenticated, but GitHub does not provide shell access.

One last point the git commands were working earlier in the day and then all of a sudden stopped working. There was also a period of time when I would run the git command it wouldn't work, and then I would run it again and it would work. But now for the last 24 hours it has consistently not worked.

Is this a problem with the internet connection or perhaps the github servers?

Looks like a problem with gist site:

$ tcptraceroute gist.github.com 22
Running:
        traceroute -T -O info -p 22 gist.github.com 
traceroute to gist.github.com (140.82.112.19), 30 hops max, 52 byte packets
 1  iskra (192.168.3.8)  0.165 ms  0.129 ms  0.125 ms
 2  10.110.23.1 (10.110.23.1)  0.503 ms  0.507 ms  0.516 ms
 3  * * *
 4  * * *
 5  10.110.2.57 (10.110.2.57)  0.460 ms  0.450 ms  0.453 ms
 6  10.110.2.62 (10.110.2.62)  0.665 ms  0.961 ms  0.981 ms
 7  msk-m9-b1-ae24-vlan384.fiord.net (62.140.243.190)  1.924 ms  1.719 ms  1.672 ms
 8  frankfurt-anc-b1-xe0-0-0.fiord.net (93.191.9.155)  38.784 ms  38.897 ms  38.876 ms
 9  xe-1-2-0.mpr1.fra4.de.above.net (80.81.194.26)  45.810 ms  45.815 ms  45.803 ms
10  ae27.cs1.fra9.de.eth.zayo.com (64.125.30.254)  120.960 ms  120.947 ms  120.935 ms
11  ae0.cs1.fra6.de.eth.zayo.com (64.125.29.54)  120.357 ms  120.360 ms  120.349 ms
12  ae2.cs1.ams17.nl.eth.zayo.com (64.125.29.59)  120.819 ms  120.840 ms  121.033 ms
13  ae0.cs1.ams10.nl.eth.zayo.com (64.125.29.80)  120.691 ms  120.688 ms  120.542 ms
14  ae2.cs1.lhr15.uk.eth.zayo.com (64.125.29.17)  120.475 ms  121.397 ms  121.351 ms
15  ae0.cs3.lhr11.uk.eth.zayo.com (64.125.29.118)  121.067 ms * *
16  ae5.cs3.lga5.us.eth.zayo.com (64.125.29.126)  121.503 ms  121.455 ms  121.468 ms
17  ae4.cs1.dca2.us.eth.zayo.com (64.125.29.203)  123.446 ms  123.452 ms  123.442 ms
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  *^C

$ tcptraceroute github.com 22
Running:
        traceroute -T -O info -p 22 github.com 
traceroute to github.com (140.82.118.3), 30 hops max, 52 byte packets
 1  iskra (192.168.3.8)  0.231 ms  0.162 ms  0.130 ms
 2  10.110.23.1 (10.110.23.1)  0.764 ms  0.753 ms  0.732 ms
 3  * * *
 4  * * *
 5  10.110.2.57 (10.110.2.57)  0.554 ms  0.543 ms  0.532 ms
 6  10.110.2.62 (10.110.2.62)  0.770 ms  0.683 ms  0.680 ms
 7  msk-m9-b1-ae24-vlan384.fiord.net (62.140.243.190)  7.158 ms  5.887 ms  5.854 ms
 8  frankfurt-anc-b1-xe0-0-0.fiord.net (93.191.9.155)  38.948 ms  38.872 ms  38.923 ms
 9  ffm-b1-link.telia.net (62.115.63.109)  42.455 ms  42.460 ms  42.450 ms
10  github-ic-350972-ffm-b1.c.telia.net (62.115.182.171)  44.401 ms  44.159 ms  44.354 ms
11  * * *
12  * * *
13  lb-140-82-118-3-ams.github.com (140.82.118.3) <syn,ack>  42.949 ms  43.084 ms  43.025 ms

$ ssh -T git@github.com
debug1: multiplexing control connection
debug1: channel 1: new [mux-control]
debug1: channel 2: new [client-session]
debug1: Sending environment.
debug1: Sending env LC_CTYPE = ru_RU.KOI8-R
debug1: Sending env LC_COLLATE = ru_RU.KOI8-R
debug1: Sending env LANG = C
debug1: client_input_channel_req: channel 2 rtype exit-status reply 0
Hi phdru! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 2: free: client-session, nchannels 3
debug1: channel 1: free: mux-control, nchannels 2

$ ssh -Tv git@gist.github.com
OpenSSH_7.4p1 Debian-10+deb9u7, OpenSSL 1.0.2u  20 Dec 2019
debug1: Reading configuration data /home/phd/.ssh/config
debug1: /home/phd/.ssh/config line 68: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug1: Control socket "/home/phd/.ssh/controls/git@gist.github.com:22" does not exist
debug1: Connecting to gist.github.com [140.82.112.20] port 22.
(…timeout…)

Use https:// protocol.

So it seems that is in fact an error with gits SSH gist server.

While this works:

streamgraph git:(master) ssh -T git@github.com
Hi adrianturcato! You've successfully authenticated, but GitHub does not provide shell access.

This times out:

streamgraph git:(master) ssh -T git@gist.github.com

How I fixed this:

I changed the git config file in terminal to force it to use HTTPS:

git config --global url."https://gist.github.com/".insteadOf git@gist.github.com
git config --global url."https://".insteadOf git://

You can always change this by using:

git config --global --edit

But this still wasn't working due to the fact my github has 2fa. So I made another github account which I will use temporarily.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM