I have created a new user on github under our organization which will be used for auto deployment. I followed the article on https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/#platform-linux.
Somehow, when I tried to clone the repository to the server, it worked once. The code was running properly, and I exit the server. Today, we released an update to the code, and I wanted to deploy the code manually to the server, so I ssh'd into the server and tried to pull the repository with
eval "$(ssh-agent -s)"
ssh -T firstname.lastname@example.org
Hi *****! You've successfully authenticated, but GitHub does not provide shell access.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
If you are using
git pull/push to the remote you need to ensure you used
sudo to generate your SSH keys. Otherwise you will not be using the same keys that you originally generated.