git Push Permission Denied

When pushing to your App's Git Remote, you might encounter the following error:

Pushing to [email protected]:[environment]/[app].git
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Ther are two common reasons this occurrs:

Wrong SSH Key


The most common caused by attempting to authenticate with a public key that is not registered with Aptible, which causes Git Authentication to fail.

You can confirm that this is indeed the issue by connecting directly using ssh:

ssh -T [email protected] test



The SSH_ORIGINAL_COMMAND: unbound variable will appear without the test command at the end.

The output of this command will indicate whether you're being correctly authenticated by Aptible's Git server.

If you are properly authenticated, you'll see this message:

Hi [email]! Welcome to Aptible. Please use `git push` to connect.

If you do not see that message, then the problem is indeed that you're not authenticating properly.


The most common cause for this error is that you haven't registered your SSH Public Key with Aptible. So, first, make sure you did that.

If you did register your public key, but you're still seeing the error, odds are you have multiple SSH keys and ssh isn't using the correct one when you connect.

To use a specific public key when connecting to Aptible, add the following to your local ~/.ssh/config file (you might need to create it):

    IdentityFile /path/to/private/key