简体   繁体   English

在 AWS ubuntu 服务器下运行的 git 上的权限被拒绝(公钥)错误

[英]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/我尝试使用此处所写的 git 部署来安装 nginx https://devmarketer.io/learn/deploy-laravel-5-app-lemp-stack-ubuntu-nginx/

But under Ubuntu under AWS.但是在 AWS 下的 Ubuntu 下。 During installation I created pem fiel and I connect to ubuintu system with ssh.在安装过程中,我创建了 pem fiel 并使用 ssh 连接到 ubuintu 系统。

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 ?我必须采取哪个步骤才能使 git 工作?

Thanks!谢谢!

You have to create non root user :您必须创建非 root 用户:

sudo useradd -m nonerootuser

with this subdirectores inside of /home/ would be created将创建 /home/ 内的此子目录

copy to /home/nonerootuser/.ssh config, id_rsa, id_rsa.pub files from your local server.从本地服务器复制到 /home/nonerootuser/.ssh config、id_rsa、id_rsa.pub 文件。 Or create them或者创建它们

Restart service with重启服务

 service sshd restart

before working with git you need to switch to this user.在使用 git 之前,您需要切换到该用户。

su -l  nonerootuser

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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