I'm attempting to deploy my code to heroku with the following command line:
git push heroku master
but get the following error:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
I have already uploaded my public SSH key, but it still comes up with this error.
The problem I faced was on Windows and invariably whenever I run the "heroku keys:add" it selected the github keys. So here are the steps I followed to resolve the issue
The above command asked me to generate a new keys and following was the output Could not find an existing public key. Would you like to generate one? [Yn] Y Generating new SSH public key. Uploading SSH public key C:/Documents and Settings/Admin/.ssh/id_rsa.pub... done ! The 'heroku' gem has been deprecated and replaced with the Heroku Toolbelt, download and install from https://toolbelt.heroku.com.
The above command will not give the following output Found existing public key: C:/Documents and Settings/Admin/.ssh/id_rsa.pub Uploading SSH public key C:/Documents and Settings/Admin/.ssh/id_rsa.pub... done
for me using the above steps solved the issue and was able to deploy the application on the cloud.
I have this issue as well. I am using Mac OSX. The way I fixed that was to login as admin
This was the solution for me:
If you've already uploaded the key then try to remove the key and then re-upload it with a new key.
this should work.
I had this problem when TortoiseGIT was installed on my machine. After changing the environment variable
GIT_SSH
fromto
and following this tutorial with
ssh-keygen
andkeys:add
, it works!One single command works:
It will make one if it doesn't exist.