无法将 git 推送到远程存储库:(SSH 错误)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4049900/
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 04:41:11  来源:igfitidea点击:

Cannot push git to remote repository: (SSH error)

gitsshgithubheroku

提问by Matt H.

When I attempt to push to my heroku.com remote git repository, i get this message:

当我尝试推送到我的 heroku.com 远程 git 存储库时,我收到以下消息:

ssh: connect to host heroku.com port 22: Connection refused

I can easily work with my repository on github with the same ssh key.

我可以使用相同的 ssh 密钥轻松地使用我在 github上的存储库

Entering:

进入:

$ssh [email protected]    #outputs: success message
$ssh [email protected]    #outputs: ssh: connect to host heroku.com port 22: Connection refused

I'm on Mac OS 10.6. And I'm very cluelessslowly learning!

我使用的是 Mac OS 10.6。而且我很无知慢慢学习!

UPDATE:

更新:

$telnet heroku.com 22

gives this output:

给出这个输出:

Trying 75.101.145.87...
telnet: connect to address 75.101.145.87: Connection refused
Trying 75.101.163.44...
telnet: connect to address 75.101.163.44: Connection refused
Trying 174.129.212.2...
telnet: connect to address 174.129.212.2: Connection refused
telnet: Unable to connect to remote host

采纳答案by Frank Shearar

Connection refused is a TCP error message saying that that server isn't running a service on that port. In this case, perhaps heroku.com's SSH server wasn't running.

连接被拒绝是一条 TCP 错误消息,表明该服务器没有在该端口上运行服务。在这种情况下,可能 heroku.com 的 SSH 服务器没有运行。

If you haven't given them your key, or you use the wrong private key, ssh will say something like this:

如果你没有给他们你的密钥,或者你使用了错误的私钥,ssh 会说这样的话:

frank@roke$ ssh [email protected]
Permission denied (publickey).

frank@roke$ ssh -i ~/.ssh/roke-frank.priv [email protected]
Permission denied (publickey).

(And the above messages indicate that right now heroku's SSH server is indeed running.)

(以上消息表明现在 heroku 的 SSH 服务器确实在运行。)

Since you're not able to connect to the same server to which I can, perhaps there's a firewall issue. Are you behind a NAT? Does your gateway permit connections to port 22 on remote machines?

由于您无法连接到我可以连接的同一台服务器,因此可能存在防火墙问题。你在 NAT 后面吗?您的网关是否允许连接到远程机器上的端口 22?

That machine runs a web server too, so try telnet heroku.com 80to see if you can connect to that machine at all.

那台机器也运行一个网络服务器,所以试着telnet heroku.com 80看看你是否可以连接到那台机器。

回答by mapcuk

It seems ssh-server wasn't working or host was offline. I think it was temporally trouble.

似乎 ssh-server 不工作或主机离线。我认为这是暂时的麻烦。

I'm trying now:

我现在正在尝试:

telnet heroku.com 22
Trying 174.129.212.2...
Connected to heroku.com (174.129.212.2).
Escape character is '^]'.
SSH-2.0-OpenSSH_5.1p1 Debian-5pgsql1

Anyway you can diagnose doing ssh -v [email protected](or -vv)

无论如何你可以诊断做ssh -v [email protected](或-vv)

回答by shingara

You need push your key to heroku.

你需要把你的钥匙推到heroku。

Because heroku and github are two distinct service. They don't share your key.

因为 heroku 和 github 是两个截然不同的服务。他们不共享您的密钥。