Report this

What is the reason for this report?

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

Posted on March 31, 2020

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 git@github.com:lizyorick/markdown-portfolio.git Here’s a screenshot of what I’m seeing.

liz@ubuntu-server:/var/www$ sudo git clone git@github.com:lizyorick/markdown-portfolio.git [sudo] password for liz: Cloning into ‘markdown-portfolio’… git@github.com: 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 git@github.com:lizyorick/markdown-portfolio.git 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!!

Liz



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.

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 https://github.com/lizyorick/markdown-portfolio.git

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.