Question

SSH permission & Git push from local to remote server

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

Subscribe
Share

Submit an 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.

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

BR, Peti

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