I've searched around for many hours on end looking to a solution to my seemingly easy-to-fix problem. It's not that my search turned up nothing, it's that my search turned up so many different solutions -none of which have worked.
Anyways, I am simply unable to push, pull, or fetch from my Heroku repository from my Mac. Every attempt gives me (as if it's mocking me) the following error:
'Permission denied (publickey). fatal: Could not read from remote repository.'
I've tried (and re-tried) to fix it in many different ways. As I've said, I've spent a good chunk of the last two days searching around for an answer. Here are some of the things I've tried:
- heroku keys:clear followed by heroku keys:add
- Regenerating an ssh key on my own with 'ssh-keygen -t rsa'
- Clearing out my .ssh directory, followed by heroku keys:clear, followed by generating an ssh key
- Deleting my app on heroku and recreating one (fortunately not much was on there)
I can fetch from my GitHub repository fine, so I know it's not network connectivity (pinging heroku also works).
As a makeshift solution (that I hope doesn't turn into a permanent one), I've logged in to my Ubuntu Amazon AWS ec2 instance. Pulling and pushing to and from Heroku works perfectly. For this reason, I still feel as if the problem lies with the ssh key on my Mac. Both keys show up under my Heroku account. Does the email address at the end of the key matter?
EDIT: I can push and pull from GitHub fine (I'm not using ssh, however), so why not Heroku?
At this point I'm willing to try anything. Thanks!
Had a similar issue, and tried lots of things. Ultimately what worked for me, was to have Gnu on Windows installed (https://github.com/bmatzelle/gow/releases) , and ensure that it was using the ssh tool inside that directory and not the one with Git. Once installed test with (ensure if its in your environment PATH that it preceds Git\bin)
I used putty and pageant as described here:http://rubyonrailswin.wordpress.com/2010/03/08/getting-git-to-work-on-heroku-on-windows-using-putty-plink-pageant/
Once the keys had been sent to heroku (heroku keys:add c:\Users\Person.ssh\id_rsa.pub), use
and ensure that your stack is showing use of Putty - ie a working stack:
One that was running previously and failed:
I'd like to add another solution since I didn't see it here. My problem was that heroku was linking to the wrong url (since I kept playing around with url names). Editing the remote url solved my problem: