【问题标题】:Error in git push heroku master through ssh behind proxygit push heroku master 中的错误通过代理后面的 ssh
【发布时间】:2012-05-11 16:54:25
【问题描述】:

简要背景:
嗨,我是一名大学生(在代理 10.3.100.211:8080 之后),刚接触 ROR、Git 和 Heroku,并且一直在关注 Ruby on Rails 教程。我使用 ~/.ssh/config 文件中的以下配置解决了通过 ssh 推送 git repo 的问题(之后它工作得很好):

Host github.com  
Hostname ssh.github.com  
User git  
ProxyCommand corkscrew 10.3.100.211 8080 %h %p  
Port 443  

问题:

但是,在关注 https://devcenter.heroku.com/articles/git 以使用 heroku 进行在线应用程序部署时,我收到以下错误:

$git push heroku master
ssh: connect to host heroku.com port 22: Connection refused  
fatal: The remote end hung up unexpectedly  

我现在的状态是:$ git remote -v

heroku  git@heroku.com:deep-dusk-1030.git (fetch)  
heroku  git@heroku.com:deep-dusk-1030.git (push)  
origin  git@github.com:shaileshgupta/testapp.git (fetch)  
origin  git@github.com:shaileshgupta/testapp.git (push)  

任何人都可以帮助我将 github.com 的设置写入我的 ~/.ssh/config 文件中,以便使用 PORT 443/22 通过代理后面的 ssh 进行无缝连接。

我们将不胜感激。

更新(更多信息) 我尝试了以下设置并收到以下错误:

配置:

Host heroku.com  
  Hostname ssh.heroku.com  
  User git  
  ProxyCommand corkscrew 10.3.100.211 8080 %h %p  
  Port 443  

错误:

$ git push heroku master  
ssh_exchange_identification: Connection closed by remote host  
fatal: The remote end hung up unexpectedly  

另一种配置:

Host github.com, heroku.com  
  Hostname ssh.github.com  
  User git  
  ProxyCommand corkscrew 10.3.100.211 8080 %h %p  
  Port 443  

错误:

$ git push heroku master  
ERROR: Repository not found.  
fatal: The remote end hung up unexpectedly  

【问题讨论】:

  • 所以...您是否需要与访问heroku.com 相同的代理配置来访问github.com
  • 我试过了,但它显示以下错误:$ git push heroku master 错误:找不到存储库。致命:远端意外挂断。
  • 使用 ssh.heroku.com 作为主机名有什么问题吗? heroku 是否也使用 ssh.heroku.com 作为主机名,因为 github 使用 ssh.github.com 作为主机名?
  • 嘿伙计们,有人可以为这个问题投票以得到答案吗? @larsks?

标签: git heroku


【解决方案1】:

在你的 .ssh/config 中写下这个:

Host git_heroku
  Hostname heroku.com
  User git
  ProxyCommand corkscrew 10.3.100.211 8080 %h %p
  Port 443

并在您的 .git/config 更改中

git@heroku.com

git_heroku

遥控器的完整行如下所示:

[remote "appname"]
  url = git_heroku:appname.git
  fetch = +refs/heads/*:refs/remotes/appname/*

git_heroku 是别名;您需要更改您的 git 配置以使用该别名。

【讨论】:

  • 你能给我一个例子来说明我的 .git/config 文件应该是什么样子吗?你是什​​么意思,“改变它以使用别名”
  • @Daniel 嘿,我复制了这个答案 - 希望它更清楚一点。我在 git 配置文件中添加了我 认为 应该包含的内容,但请告诉我它是否适合您。
  • 当你说“git_heroku 是一个别名”时,你的意思是 git@heroku.com 的别名,对吧?所以配置文件中的那行应该是:[alias] git_heroku = git@heroku.com ...对吗?
  • 不,是ssh别名,因为你写在.ssh/config中。
【解决方案2】:

除了在您的 .ssh/config 中回答上述问题:

  • 使用ssh.heroku.com 代替Hostname 而不是heroku.com
  • 确保包含您的身份文件IdentityFile "path to identity file"
  • 不要指定Port

所以我的 .ssh/config 文件看起来像这样:

Host git_heroku
ProxyCommand corkscrew proxy.usurt.ru 3128 %h %p
HostName ssh.heroku.com
User git
IdentityFile "~/.ssh/id_rsa.pub"

以及 .git/config 文件中的相应行:

[remote "heroku"]
    url = git_heroku:still-taiga-2820.git
    fetch = +refs/heads/*:refs/remotes/heroku/*

【讨论】:

    猜你喜欢
    • 2014-07-05
    • 2013-02-03
    • 2016-12-26
    • 1970-01-01
    • 1970-01-01
    • 2016-02-19
    • 1970-01-01
    • 2019-10-14
    • 2014-10-26
    相关资源
    最近更新 更多