7

I'm unable to push use git push in github as well as heroku, i have tried various methods as suggested on this question . pls help to resolve this problem .. i see the following report while i try to push.

D:\My\weblog>git push heroku master
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

D:\My\weblog>ssh -v git@heroku.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to heroku.com [50.16.232.130] port 22.
debug1: Connection established.
debug1: identity file /.ssh/identity type -1
debug1: identity file /.ssh/id_rsa type -1
debug1: identity file /.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debia
n-5pgsql1
debug1: match: OpenSSH_5.1p1 Debian-5pgsql1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'heroku.com' is known and matches the RSA host key.
debug1: Found key in /.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /.ssh/identity
debug1: Trying private key: /.ssh/id_rsa
debug1: Trying private key: /.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

Am using windows 7 .

Community
  • 1
  • 1
sakthig
  • 2,187
  • 3
  • 18
  • 22
  • erm, you don't have permission? – Hamish Feb 27 '11 at 23:15
  • possible duplicate of [Permission denied (publickey) when deploying heroku code. fatal: The remote end hung up unexpectedly](http://stackoverflow.com/questions/4269922/permission-denied-publickey-when-deploying-heroku-code-fatal-the-remote-end) – Nakilon Jan 15 '12 at 00:54

8 Answers8

17

type in gem install heroku

Then upload rsa key of github to heroku

$ heroku keys:add
Uploading ssh public key /Users/adam/.ssh/id_rsa.pub

Once you key in configured with heroku and github with command all your code goes to github and from there to Heroku

git push heroku master 

and soon you will see these messages

-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Detected Rails is not set to serve static_assets
Dty
  • 12,253
  • 6
  • 43
  • 61
Harshit Pandey
  • 211
  • 3
  • 8
5

It looks like heroku isn't accepting your machine's public keys. Be sure that you've given your public key to heroku. Heroku's guide on SSH keys should help.

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
  • Are you able to SSH to other servers using public keys? – Andrew Marshall Feb 28 '11 at 00:05
  • I am newbie and am unable access github and heroku for now.. i tried to work it on ubuntu but its even worse.. heroku wont even install in ubuntu !! – sakthig Feb 28 '11 at 13:32
  • Try making a backup of your local keys and restarting the entire key-setup process on Windows. You can also try contacting Heroku's support as well. – Andrew Marshall Feb 28 '11 at 16:47
2

I ran into a similar issue on OSX with heroku-toolbelt/2.32.8. Even after following heroku I was unsuccessful until I used a key in the default path - IE ~/.ssh/id_rsa.pub.

sksizer
  • 221
  • 2
  • 2
2

you can try this

http://devcenter.heroku.com/articles/keys

rustybrain
  • 21
  • 1
  • This link helped me fix the same problem. I used heroku keys to see I had two keys. Then I typed heroku remove:keys email@email.com twice to remove them - then used heroku add:keys - and when I tried to push to heroku, it worked. – Bob Cavezza Dec 04 '11 at 22:06
1

I had the same issue - turns out I forgot that Windows 8 doesn't start the command prompt with admin privileges by default like Windows 7 did. Running it as administrator fixed my issue.

1

On ubuntu sudo su solved it for me.

When I used ssh to generate the key, then if you read the contents of "id_rsa.pub" there's a username at the end of the file. For me it was "root@pc-name", but without sudo su the current username is "username@pc-name" instead of "root@pc-name". sudo su solves that by switching to "root@pc-name".

Beryllium
  • 12,808
  • 10
  • 56
  • 86
  • This solution worked for me. I suspect that a better practice is to generate a key with the user role rather than use the root one. – mpgarate Sep 07 '13 at 00:34
0

If using Windows and Cygwin, I had to start Cygwin with admin privileges before it would let me push to Heroku.

FluffyBeing
  • 448
  • 1
  • 11
  • 27
0

I faced the same problem. I solved it with change cmd command with Git Bash. Do everything on Git.

angel
  • 1