11

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  

Problem:

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  

My current status is: $ 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)  

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.

Any help will be highly appreciated.

Update (Some More Information) I tried following settings and got following errors:

Configuration:

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

Error:

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

Another Configuration:

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

Error:

$ git push heroku master  
ERROR: Repository not found.  
fatal: The remote end hung up unexpectedly  
shailesh
  • 865
  • 1
  • 11
  • 18
  • So...don't you need the same proxy configuration to reach `heroku.com` as you need to reach `github.com`? – larsks May 11 '12 at 17:28
  • I tried it, but it is showing following error: **$ git push heroku master** ERROR: Repository not found. fatal: The remote end hung up unexpectedly. – shailesh May 11 '12 at 18:39
  • Is there any problem with using ssh.heroku.com as Hostname? Does heroku also uses ssh.heroku.com as Hostname as github uses ssh.github.com for Hostname? – shailesh May 12 '12 at 07:47
  • hey guys, can someone upvote this question to have an answer to it? @larsks? – shailesh May 17 '12 at 10:33

2 Answers2

5

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

and in your .git/config change

git@heroku.com

to

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 is an alias; you need to change your git config to use that alias.

culix
  • 10,188
  • 6
  • 36
  • 52
BGuimberteau
  • 249
  • 1
  • 8
  • Can you give me an example of exactly how my .git/config file should look? What do you mean, "change it for use alias" – Daniel Feb 05 '13 at 19:44
  • @Daniel Hey I copyedited this answer - hopefuly it's a bit more clear. I added what I *think* should go in the git config file, but let me know if it works for you. – culix Feb 17 '13 at 23:27
  • When you say "git_heroku is an alias", you mean an alias for git@heroku.com, right? So the line in the config file should be: [alias] git_heroku = git@heroku.com ...is that right? – grooble Apr 04 '13 at 00:30
  • No, it's a ssh alias, because you write in the .ssh/config. – BGuimberteau Apr 10 '13 at 20:54
  • could you please help me with - http://stackoverflow.com/questions/21600830/ssh-ing-to-remote-server-from-behind-a-proxy – whatf Feb 06 '14 at 11:04
1

In addition to answer above in your .ssh/config:

  • use ssh.heroku.com for Hostname instead of heroku.com
  • make sure you include your identity file IdentityFile "path to identity file"
  • don't specify Port

So my .ssh/config file looks something like this:

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

And appropriate lines in .git/config file:

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