cannot ssh into git from liz@ubuntu-server Permission denied (publickey) fatal: Could not read from remote repository.

Posted March 31, 2020 6.1k views

Hi all, I’m brand new to web development and DO. I’m following a tutorial on Full Stack Web Development. I managed to create a droplet, create a new sudo user for myself that I can SSH into my DO server with. One thing I noticed after creating the new user and adding it to groups sudo and admin, I now see a $ instead of the # after my userid whereas when using root it was the #. Not sure if that is causing my problems. I created a ssh key from within my droplet and printed it to the screen. Copied that manually into a new SSH key in my Github account. I cloned a repo using ssh and then typed sudo git clone Here’s a screenshot of what I’m seeing.

liz@ubuntu-server:/var/www$ sudo git clone
[sudo] password for liz:
Cloning into ‘markdown-portfolio’… Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
liz@ubuntu-server:/var/www$ git clone
fatal: could not create work tree dir 'markdown-portfolio’: Permission denied
liz@ubuntu-server:/var/www$ ls -la
total 12
drwxr-xr-x 3 root root 4096 Mar 31 17:04 .
drwxr-xr-x 14 root root 4096 Mar 31 16:00 ..
drwxr-xr-x 2 root root 4096 Mar 31 16:00 html

Shouldn’t my username be in place of root when I ls? How do I fix this? Please help!!


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.

Submit an Answer
1 answer

If I follow your post;

  • try set the permissions of your ww dir
cd /var
sudo chown -Rf liz:www-data www
cd /var/www

Then clone your repo.

Also - try cloning over https now ssh

git clone