Permission denied could not read from remote repository
I am attempting to clone a git repo from inside an ubuntu 20 server, but after it permanently adds my ECSDA key, I get the following error:
: Permission denied (publickey).
fatal: Could not read from remote repository.I do have access to it from my local machine, but how do I access that Github repo from this Ubuntu server?
I tried to clone it by running, sudo git clone :MyRepo/api-service.git
To to be clear this repository is up on Github and I am inside an ubuntu 20 server trying to clone it.
Is this not a matter of adding the keys from Github?
112 Answers
Step 1. - From within your Ubuntu server run ssh-keygen -t rsa
Step 2. - From within your Ubuntu server run cat ~/.ssh/id_rsa.pub
Step 3. - Copy and paste the resulting key and paste it into Github account, by going to Settings, then *SSH and GPG section and click the New SSH key button.
Step 4. - Go back to your Ubuntu server and run git clone :MyGithubRepo/service-api.git
For what it's worth, you should always be able to clone via https.
e.g., git clone
If you want to clone via ssh, however, you do indeed need to add a key as described in Daniel's answer. This is due to a recent change in GitHub's ssh requirements, as mentioned by Nate T.