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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33377296/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 11:28:46  来源:igfitidea点击:

ssh: connect to host bitbucket.org port 22: Connection timed out

gitsshbitbucketiptables

提问by user3489502

Everything was working perfectly fine. Did some git push and no problems.

一切正常。做了一些 git push 没有问题。

Today I decided to update my framework to the latest version, so it changed the directory structure of my project a bit. So within bitbucket, i've created a new repository (dev1.project.com), and renamed my project's folder from OldName to dev1.project.com

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

I edited .git/configto point my new repository:

我编辑.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/*

When I do git remote -v

当我做 git remote -v

I get : origin ssh://[email protected]/user/dev1.project.com.git (fetch) origin ssh://[email protected]/user/dev1.project.com.git (push)

我得到: origin ssh://[email protected]/user/dev1.project.com.git (fetch) origin ssh://[email protected]/user/dev1.project.com.git (push)

I go back to my project folder, and type:

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

git init
git add .      
git commit -m 'my first commit'
git push -u origin master

but I keep getting the following error:

但我不断收到以下错误:

ssh: connect to host bitbucket.org port 22: Connection timed out
fatal: The remote end hung up unexpectedly

The command ssh -T [email protected]gets me the same messages as above.

该命令为ssh -T [email protected]我提供了与上述相同的消息。

The command: git config --get remote.origin.urlshows:

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

[email protected]:user/dev1.project.com.git

http://status.bitbucket.org/shows that everything works fine on their side.

http://status.bitbucket.org/显示在他们这边一切正常。

Not sure why it was working before, and not working now.

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

I'm on CentOS and i'm not sure what I should do next. I've seen a couple iptables related answers, so I tried this:

我在 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

But still nothing, any ideas?

但仍然什么都没有,有什么想法吗?

Ps: I've also update CentOS from 6.6 to 6.7 and php 5.4 to 5.6, but didn't think it would matter.

Ps:我也将 CentOS 从 6.6 更新到 6.7,将 php 5.4 更新到 5.6,但认为这无关紧要。

update #1

更新 #1

Ran the following commands:

运行以下命令:

ps x | grep ssh-agent
eval `ssh-agent -s`
ssh-add     --> then it asked for my password

Got the message:

得到消息:

Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)

Then

然后

service sshd restart

But still nothing

但还是什么都没有

update #2

更新 #2

I email my vps hosting company, asking if there is anything I can do to open port 22, and then answered:

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

I have disabled the monitoring system on the host node blocking traffic to Bitbucket.

I don't know what it means, but everything was working after that, and apparently I couldn't do anything about it.

我不知道这意味着什么,但在那之后一切正常,显然我对此无能为力。

回答by Pardeep Kumar

I have done below mentioned things and it started working.

我已经完成了下面提到的事情并且它开始工作了。

 vim ~/.ssh/config

Add these lines and save it.

添加这些行并保存。

Host bitbucket.org
Hostname  altssh.bitbucket.org
Port  443