簡體   English   中英

在 AWS ubuntu 服務器下運行的 git 上的權限被拒絕(公鑰)錯誤

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

我嘗試使用此處所寫的 git 部署來安裝 nginx https://devmarketer.io/learn/deploy-laravel-5-app-lemp-stack-ubuntu-nginx/

但是在 AWS 下的 Ubuntu 下。 在安裝過程中,我創建了 pem fiel 並使用 ssh 連接到 ubuintu 系統。

但是用命令推送到服務器

git push production master 

我有錯誤

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.

我必須采取哪個步驟才能使 git 工作?

謝謝!

您必須創建非 root 用戶:

sudo useradd -m nonerootuser

將創建 /home/ 內的此子目錄

從本地服務器復制到 /home/nonerootuser/.ssh config、id_rsa、id_rsa.pub 文件。 或者創建它們

重啟服務

 service sshd restart

在使用 git 之前,您需要切換到該用戶。

su -l  nonerootuser

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM