ssh: connect to host github.com port 22: Connection timed out

前端 未结 17 2384
陌清茗
陌清茗 2020-12-04 05:25

I am under a proxy and I am pushing in to git successfully for quite a while.
Now I am not able to push into git all of a sudden.
I have set the RSA key and the prox

相关标签:
17条回答
  • 2020-12-04 05:47

    Changing the repo url from ssh to https is not very meaningful to me. As I prefer ssh over https because of some sort of extra benefits which I don't want to discard. Above answers are pretty good and accurate. If you face this problem in GitLab, please go to their official documentation page and change your config file like that.

    Host gitlab.com
      Hostname altssh.gitlab.com
      User git
      Port 443
      PreferredAuthentications publickey
      IdentityFile ~/.ssh/gitlab
    
    0 讨论(0)
  • 2020-12-04 05:47

    The answer above gave me the information needed to resolve this issue. In my case the url was incorrectly starting with ssh:///

    To check the url in your git config is correct, open the git config file :-

    git config --local -e
    

    Check the url entry. It should NOT have ssh:/// at the start.

    Incorrect entry:

     url = ssh:///git@github.com:username/repo.git
    

    Correct entry:

     url = git@github.com:username/repo.git
    

    If your url is correct, then the next step would be to try the answer above that suggests changing protocol to http.

    0 讨论(0)
  • 2020-12-04 05:49

    I had this issue on a server of mine that was set up with it's regular IP and a failover IP. The failover IP did not point to the server at this time. I had to remove the failover IP from the server configuration in /etc/netplan/01-netcfg.yaml. Pointing the failover IP to that server would have probably solved the issue as well.

    0 讨论(0)
  • 2020-12-04 05:49

    For me, the problem was from ISP side. The Port number was not enabled by the Internet Service Provider. So asked them to enable the port number over my network and it started working.
    Only to test: Connect to mobile hotspot and type ssh -T git@bitbucket.org or git pull.
    If it works, then ask your ISP to enable the port.

    0 讨论(0)
  • 2020-12-04 05:50

    Restart computer solved it for me.
    Git version: 2.27.0.windows.1
    OS version: Windows 10 v1909

    0 讨论(0)
提交回复
热议问题