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.


This error is caused by attempting to authenticate with a public key that is not registered with Aptible Deploy, which causes Git Authentication to fail.

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

ssh -T [email protected]

The output of this command will indicate whether you're being correctly authenticated by Aptible Deploy'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 Deploy. 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 Deploy, add the following to your local ~/.ssh/config file (you might need to create it):

        IdentityFile /path/to/private/key

Did this page help you?