Heroku Permission denied (publickey)

For the last 4 weeks, we’ve been deploying to Heroku with NO issues.

As of today, the problem I originally reported has returned…

There’s been no changes to the deploy code or heroku. Things just stopped… Very frustrating.

Pushing master to git@heroku.xxx-bayou-9283.git
Warning: Warning: Permanently added the RSA host key for IP address '50.19.85.156' to the list of known hosts.

Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
a Use --force to continue.

Aborted due to warnings.

If anyone else is struggling with this… If you’re sure your settings are correct, I managed to fix by re-adding my Heroku key AND deleting my ssh-keys. Then re-added.

Not sure why but looks like something was out of sync.

In terms of the deploy script I’m using, this is it. Also for future reference of others, we use grunt:

#!/bin/sh -e

git config --global user.email "simon@my-email.com"
git config --global user.name "Simon"

echo yes | heroku keys:add 
grunt build
yes | grunt buildcontrol:heroku 
echo "...done."