简体   繁体   English

Git克隆到Amazon AWS EC2实例的私有存储库

[英]Git clone private repo to Amazon AWS EC2 instance

I'm trying to clone a private git repo into an Amazon AWS EC2 instance (Bitnami MEAN stack running Linux) 我正在尝试将私有git存储库克隆到Amazon AWS EC2实例(运行Linux的Bitnami MEAN堆栈)

I have created ssh keys for the user "bitnami" and added the public key to my Github account. 我已经为用户“ bitnami”创建了ssh密钥,并将公共密钥添加到了我的Github帐户。

Problem is that the user "bitnami" does not have sufficient permissions: 问题是用户“ bitnami”没有足够的权限:

bitnami@ip-xxx-xx-xx-xx:~/apps$ git clone git@github.com:MyGitUserName/MyRepoName.git
fatal: could not create work tree dir 'MyGitRepo'.: Permission denied

One solution would be to switch to root user: $ sudo su 一种解决方案是切换到root用户:$ sudo su

But to my surprise the ssh keys I generated for the "bitnami" user do not exist for root user. 但是令我惊讶的是,我为“ bitnami”用户生成的ssh密钥对于root用户不存在。 At least, the /.ssh directory is missing the ssh keys when I switch to root user and reappear when I change back to the "bitnami" user. 至少,当我切换到root用户时,/。ssh目录缺少ssh密钥,而当我切换回“ bitnami”用户时,它会再次出现。

So, what the best approach here? 那么,这里最好的方法是什么? I want the "bitnami" user to have read/write/executable rights to the ~/apps folder. 我希望“ bitnami”用户具有〜/ apps文件夹的读/写/可执行权限。

Looking at this answer: Could not create work tree dir 'example.com'.: Permission denied 看着这个答案: 无法创建工作树目录“ example.com” 。:权限被拒绝

I tried: 我试过了:

sudo chown -R bitnami apps

But I get the same error 但是我得到了同样的错误

Okay, I know why it failed. 好吧,我知道为什么失败了。

When going: sudo chown -R bitnami apps 何时去:sudo chown -R bitnami应用

I needed to run that command as root and not as the user I'm granting the rights to. 我需要以root用户而不是我授予其权限的用户身份运行该命令。

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

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