ssh:连接到主机bitbucket.org端口22:连接超时

use*_*502 12 git ssh iptables bitbucket

一切都很好.有些git推,没有问题.

今天我决定将我的框架更新到最新版本,所以它稍微改变了我项目的目录结构.所以在bitbucket中,我创建了一个新的存储库(dev1.project.com),并将我的项目文件夹从OldName重命名为dev1.project.com

我编辑.git/config指向我的新存储库:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[branch "master"]
[remote "origin"]
        url = https://bitbucket.org/user/dev1.project.com.git
        fetch = +refs/heads/*:refs/remotes/origin/*
Run Code Online (Sandbox Code Playgroud)

当我做 git remote -v

我得到:origin ssh://git@bitbucket.org/user/dev1.project.com.git(fetch)origin ssh://git@bitbucket.org/user/dev1.project.com.git(push)

我回到我的项目文件夹,然后输入:

git init
git add .      
git commit -m 'my first commit'
git push -u origin master
Run Code Online (Sandbox Code Playgroud)

但我一直收到以下错误:

ssh: connect to host bitbucket.org port 22: Connection timed out
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)

该命令为ssh -T git@bitbucket.org我提供了与上面相同的消息.

命令:git config --get remote.origin.url 显示:

git@bitbucket.org:user/dev1.project.com.git
Run Code Online (Sandbox Code Playgroud)

http://status.bitbucket.org/表明一切正常.

不知道为什么它以前工作,现在不工作.

我在CentOS上,我不确定下一步该做什么.我见过几个与iptables相关的答案,所以我尝试了这个:

iptables -t filter -A OUTPUT -p tcp --match multiport --dport 22 -j ACCEPT

service iptables stop
service ip6tables stop
service sshd reload
service iptables start
service ip6tables start
Run Code Online (Sandbox Code Playgroud)

但仍然没有,任何想法?

Ps:我也将CentOS从6.6更新到6.7,将php 5.4更新到5.6,但不认为这很重要.

更新#1

执行以下命令:

ps x | grep ssh-agent
eval `ssh-agent -s`
ssh-add     --> then it asked for my password
Run Code Online (Sandbox Code Playgroud)

得到消息:

Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)
Run Code Online (Sandbox Code Playgroud)

然后

service sshd restart
Run Code Online (Sandbox Code Playgroud)

但仍然没有

更新#2

我给我的vps托管公司发电子邮件,询问我是否可以做任何事情来打开端口22,然后回答:

I have disabled the monitoring system on the host node blocking traffic to Bitbucket.
Run Code Online (Sandbox Code Playgroud)

我不知道这意味着什么,但事后一切都在发挥作用,显然我无能为力.

Par*_*mar 24

我做了下面提到的事情,它开始工作了.

 vim ~/.ssh/config
Run Code Online (Sandbox Code Playgroud)

添加这些行并保存.

Host bitbucket.org
Hostname  altssh.bitbucket.org
Port  443
Run Code Online (Sandbox Code Playgroud)

  • 你是我的救星! (3认同)
  • 请检查以下链接。它将帮助您了解问题 https://about.gitlab.com/2016/02/18/gitlab-dot-com-now-supports-an-alternate-git-plus-ssh-port/ http:// www.garbers.co.za/2014/03/03/connecting-to-bitbucket-on-https-port/ (2认同)