Reputation: 79
ssh: connect to host bitbucket.org port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
My firewalls are disabled and I still get connection time out. What should I do?
Upvotes: 7
Views: 34895
Reputation: 2876
This worked for me.
Host github.com
Hostname ssh.github.com
Port 443
User git
I suggest you reading this github docs
Upvotes: -1
Reputation: 2752
Looks like you have issues with the default SSH port and they could be avoided by using another port. This is a common issue.
Basically, you can use port 443 instead of 22.
To set this in your ssh config, edit the file at ~/.ssh/config, and add this section:
Host github.com Hostname ssh.github.com Port 443
BitBucket: Answers below confirmed you can still do this even though it was supposed to be discontinued on June 15, 2011:
Host bitbucket.org
Hostname altssh.bitbucket.org
Port 443
For Gitlab, the ssh config looks like this. Update the IdentityFile to match your local private key:
Host gitlab.com
Hostname altssh.gitlab.com
User git
Port 443
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitlab
Sources:
https://about.gitlab.com/2016/02/18/gitlab-dot-com-now-supports-an-alternate-git-plus-ssh-port/
https://help.github.com/en/articles/using-ssh-over-the-https-port
Upvotes: 14
Reputation: 4258
I am bit late to answer but my config file works for both GitHub and BitBucket
Host bitbucket.org
Hostname altssh.bitbucket.org
Port 443
Host github.com
Hostname ssh.github.com
Port 443
Upvotes: 0
Reputation: 329
For Bitbucket this worked for me:
Host bitbucket.org
Hostname altssh.bitbucket.org
Port 443
Upvotes: 0