问题描述
简要背景:
我是一名大学生(在代理 10.3.100.211:8080 后面),刚接触 ROR、Git &Heroku 并一直在关注 Ruby on Rails 教程.我使用 ~/.ssh/config 文件中的以下配置解决了通过 ssh 推送 git repo 的问题(之后它运行良好):
Brief Context:
Hi, I am a university student (behind proxy 10.3.100.211:8080), new to ROR, Git & Heroku and have been following Ruby on Rails tutorial. I solved the problem of pushing git repo through ssh using following config in my ~/.ssh/config file (and it worked perfectly after that):
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 进行在线应用部署,出现以下错误:
However, on following https://devcenter.heroku.com/articles/git to use heroku for online app deployment, I am getting following error:
$git push heroku master
ssh: connect to host heroku.com port 22: Connection refused
fatal: The remote end hung up unexpectedly
我目前的状态是:$ git remote -v
My current status is: $ git remote -v
heroku [email protected]:deep-dusk-1030.git (fetch)
heroku [email protected]:deep-dusk-1030.git (push)
origin [email protected]:shaileshgupta/testapp.git (fetch)
origin [email protected]:shaileshgupta/testapp.git (push)
任何人都可以帮助我使用 github.com,例如将 heroku.com 的设置写入我的 ~/.ssh/config 文件中,以便使用 PORT 443/22 通过代理背后的 ssh 进行无缝连接.
Can anyone help me with github.com like settings for heroku.com to be written in my ~/.ssh/config file for seamless connection through ssh behind proxy using PORT 443/22.
任何帮助将不胜感激.
更新(更多信息)我尝试了以下设置并出现以下错误:
Update (Some More Information)I tried following settings and got following errors:
配置:
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 中这样写:
In your .ssh/config write this :
Host git_heroku
Hostname heroku.com
User git
ProxyCommand corkscrew 10.3.100.211 8080 %h %p
Port 443
并在您的 .git/config 更改中
and in your .git/config change
[email protected]
到
git_heroku
遥控器的完整行如下所示:
The full line for a remote will look something like:
[remote "appname"]
url = git_heroku:appname.git
fetch = +refs/heads/*:refs/remotes/appname/*
git_heroku
是一个别名;您需要更改您的 git 配置以使用该别名.
git_heroku
is an alias; you need to change your git config to use that alias.
这篇关于git push heroku master 中的错误通过代理后面的 ssh的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!