Question

ERROR **Permission denied (publickey). fatal: Could not read from remote repository** While running: "git push production master"

Hello, guys.

It is my first time deploying by myself. So I am following this tutorial: https://devmarketer.io/learn/deploy-laravel-5-app-lemp-stack-ubuntu-nginx/. I am having an issue when pushing to the server. I receive the error below when I run “git push production master”. Any idea?

Permission denied (publickey).
fatal: Could not read from remote repository.

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

Thank you in advance. Shola


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello Shola,

Permission denied (publickey).
fatal: Could not read from remote repository.

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

This simply means that you don’t have the right permissions to ssh into your droplet. As it looks, you are missing a private ssh key. Have you setup your droplet with an RSA key? This private ssh key also has to be available on the development server before you can push things.

If you have multiple production servers or servers secured with a SSH key, you could use a ssh configuration like this:

Host            gitserv
    Hostname        remote.server.com
    IdentityFile    ~/.ssh/id_rsa.github
    IdentitiesOnly yes # see NOTES below

I hope this is helpfull. If you need anything else don’t hesistate to ask me.

Google the 2 errors you stated and come back if you find nothing at all.