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!
I had a similar heroku ssh error that I could not resolve.
As a workaround, I used the new heroku http-git feature (http transport for "heroku" remote instead of ssh). Details here: https://devcenter.heroku.com/articles/http-git
(Short version: if you have a project already setup the standard way, run heroku git:remote --http-init to change "heroku" remote to http.)
A good quick work around if you don't have time to fix/troubleshoot an ssh issue.
SO So So simple solution , go to c:/Users/user_name/.ssh/ and delete all pub / private key pairs , this way heroku will generate keys for you.
My way on Windows 8
Add a directory with ssh-keygen to the system PATH variable, usually C:\Program Files (x86)\Git\bin
Open CMD, go to C:\Users\Me\
Generate SSH key
ssh-keygen -t rsa
Enter file in which to save the key (//.ssh/id_rsa): .ssh/id_rsa (change a default incorrect path to .ssh/somegoodname_rsa)
Add the key to Heroku
heroku keys:add
Select a created key from a list
Go to your app directory, write some beautiful code
Init a git repo
git init
git add .
git commit -m 'chore(release): v0.0.1
Create Heroku application
heroku create
Deploy your app
git push heroku master
Open your app
heroku open
I had the same issue. And I tried to reset my keys as everyone said, but it still didn't worked. For was because I renamed the app.
So what I did was to reset my keys and also rename app from console. Check this question for more information: Heroku push app problem
I just thought I'd share that I found the answer to my own question.
Writing out my problem made it even more clear to me, and I further investigated into where I thought my problem lay: the ssh key
Turns out I was right. The issue wasn't with the key itself, but rather that I had not added it to my local Mac's list of known ssh keys. So even though my Heroku account had the correct key uploaded, my Mac could not authenticate with it because it could not find that key on my computer. The solution?
I would like to give credit to https://help.github.com/articles/error-permission-denied-publickey for being a good reference.
I use this method to solve this problem Maybe you can try it
"Enable ssh-agent"
http://git-scm.com/
Install it
Enable ssh-agent
C:\Program Files\Git\cmd
start-ssh-agent
The message disapper after I agent enabled Hope this will help you