簡體   English   中英

無法將 git 推送到遠程存儲庫:(SSH 錯誤)

[英]Cannot push git to remote repository: (SSH error)

當我嘗試推送到我的 heroku.com 遠程 git 存儲庫時,我收到此消息:

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

我可以 使用相同的 ssh 密鑰輕松使用 github 上的存儲庫。

輸入:

$ssh git@github.com    #outputs: success message
$ssh git@heroku.com    #outputs: ssh: connect to host heroku.com port 22: Connection refused

我在 Mac OS 10.6 上。 而且我 很無能 慢慢學習!

更新:

$telnet heroku.com 22

給出這個 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

連接被拒絕是一條TCP錯誤消息,表明該服務器未在該端口上運行服務。 在這種情況下,heroku.com的SSH服務器可能沒有運行。

如果您沒有給他們您的密鑰,或者您使用了錯誤的私鑰,那么ssh會說出這樣的內容:

frank@roke$ ssh git@heroku.com
Permission denied (publickey).

frank@roke$ ssh -i ~/.ssh/roke-frank.priv git@heroku.com
Permission denied (publickey).

(以上消息表明,目前heroku的SSH服務器確實正在運行。)

由於您無法連接到同一台服務器,因此可能存在防火牆問題。 您是否在使用NAT? 您的網關是否允許連接到遠程計算機上的端口22?

該機器也運行Web服務器,因此請嘗試telnet heroku.com 80 ,看看是否可以連接到該機器。

似乎ssh-server無法正常工作或主機處於脫機狀態。 我認為這是暫時的麻煩。

我正在嘗試:

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

無論如何,您都可以診斷為執行ssh -v git@heroku.com (或-vv)

您需要將鑰匙推到heroku。

因為heroku和github是兩個不同的服務。 他們不共享您的密鑰。

我剛剛遇到了這個已經工作了很長時間的東西,突然在我所有的電腦和所有和我一起工作的人身上壞了,如果它有幫助的話。 我們的問題是我們的.git/config使用 @ github url。

示例:而不是這個

[remote "heroku-some-site"]
  url = git@heroku.com:some-site.git
  fetch = +refs/heads/*:refs/remotes/heroku/*

做這個

[remote "heroku-some-site"]
  url = https://git.heroku.com/some-site.git
  fetch = +refs/heads/*:refs/remotes/heroku/*

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM