My git push failed with Permission denied (publickey).

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

Pushing to[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 Enclave, which causes Git Authentication to fail.

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

ssh -T

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

        IdentityFile /path/to/private/key