简体   繁体   中英

Permission denied (publickey) error on git run under AWS ubuntu server

I try to install nginx with git deployment as written here https://devmarketer.io/learn/deploy-laravel-5-app-lemp-stack-ubuntu-nginx/

But under Ubuntu under AWS. During installation I created pem fiel and I connect to ubuintu system with ssh.

But pushing to the server with command

git push production master 

I got error

root@ec2-NN-NN-NN-NN.us-east-2.compute.amazonaws.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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

Which step have I to take to make git working ?

Thanks!

You have to create non root user :

sudo useradd -m nonerootuser

with this subdirectores inside of /home/ would be created

copy to /home/nonerootuser/.ssh config, id_rsa, id_rsa.pub files from your local server. Or create them

Restart service with

 service sshd restart

before working with git you need to switch to this user.

su -l  nonerootuser

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM