SSH permission & Git push from local to remote server

Posted January 8, 2018 5.5k views
GitUbuntu 16.04

I am trying to setup a git repo on my local than can push to my ubuntu server. I have been following this tutorial . I have also FTPed in to the server to make sure all my files are being edited/created. Under ‘Setup a Git User and Install Git on your VPS’ step I followed the commands to create a user git. I checked to see if it exists with the command 'compgen -u’ . Yep I see git there. When I put in the next step I get the following errors:

git@K-home:/$ mkdir ~/.ssh && touch ~/.ssh/authorized_keys
mkdir: cannot create directory ‘/home/git/.ssh’: No such file or directory

I checked the /home directory and I see another user I created. However, I do not see the git user that I apparently created.

I also tried to copy and paste that user and update the name to git, didnt work since when I try to push from my local to that remote I get this error

mMP$ git push upstream master
Permission denied (publickey).
fatal: Could not read from remote repository.

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

can you guys help? I am not sure what I am doing wrong here

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
3 answers

Do not use “useradd” command instead use “adduser” in order to add git user.

Hi kazlisak!
Did you find the solution? I have a very similar topic..