Report this

What is the reason for this report?

Digital Ocean Droplet and GitHub

Posted on May 4, 2023

I have followed the tutorial

https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps

But I cannot get it to work I keep getting the following message

git push production master root@MYSITE.com: Permission denied (publickey). fatal: Could not read from remote repository.

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



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!

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.
0

Accepted Answer

Hello @squarenet

It seems you’re experiencing issues with git push and receiving a Permission denied (publickey) error message. This issue is generally due to the server not recognizing your SSH key.

To resolve this issue, please follow these steps:

  1. Make sure you have the correct SSH key in the ~/.ssh/id_rsa.pub file on your local machine.
  2. Check if your public SSH key is in the ~/.ssh/authorized_keys file on your server, and if it’s not, add it to the file (you can use ssh-copy-id command to do that).
  3. Ensure that the file permissions for the ~/.ssh directory (700) and ~/.ssh/authorized_keys file (600) are correct on the server.

For more information on working with SSH keys, check out this DigitalOcean guide on Adding SSH Keys.

Hope that this helps!

Heya,

From the error provided, it seems like your public key doesn’t have access to your github repository.

You’ll need to add your server’s public key to your repository in order for you to be able to access it from the server.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.