简要上下文:
嗨,我是一名大学生(在代理 10.3.100.211:8080 后面(,刚接触 ROR、Git 和 Heroku,并且一直在关注 Ruby on Rails 教程。我在我的 ~/.ssh/config 文件中使用以下配置解决了通过 ssh 推送 git 存储库的问题(之后它运行良好(:
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 设置,例如将 heroku.com 写入我的 ~/.ssh/config 文件中,以便使用端口 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
在你的 .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 配置来使用该别名。
除了在 .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/*