添加用户到Gitolite,权限被拒绝。

时间:2023-01-26 12:04:34

I have a Gitolite server running on EC2 that works pretty well. I've added users before and have no problem adding repositories.

我有一个运行在EC2上的Gitolite服务器,它运行得很好。我以前添加过用户,添加存储库没有问题。

My Macbook Pro can push code to a repository with no problem (it has the RW+ permission on the repo). I've also added a second computer to the repository with R permissions so I can clone it.

我的Macbook Pro可以毫无问题地将代码推送到存储库中(它在repo上具有RW+权限)。我还添加了另一台具有R权限的计算机到存储库中,以便可以克隆它。

The issue is, I keep getting "Permission Denied (public key)" when trying to clone the repo. When I SSH into the server with Gitolite and look at the user "git"'s authorized_keys file, I do see the public key of the second computer, so I'm not sure what the problem is-- it looks like it is getting added just fine. The public key of the second computer is also located under keydir with the appropriate name (raspberry.pub)

问题是,在尝试克隆repo时,我一直在获得“拒绝(公开密钥)”的许可。当我使用Gitolite SSH登录到服务器并查看用户“git”的authorized_keys文件时,我确实看到了第二台计算机的公钥,所以我不确定是什么问题——看起来添加的很好。第二台计算机的公钥也位于keydir中,并具有相应的名称(raspberry.pub)

Here's my gitolite conf, with some info changed to protect privacy:

以下是我的gitolite conf,为了保护个人隐私,我修改了一些信息:

repo    statistics-app
        RW+     =   andrew
        R       =   raspberry

Note: "andrew" can push code and clone the repo just fine, but the user "raspberry" cannot. What's the issue?

注意:“andrew”可以推动代码并克隆repo,但是用户“raspberry”不能。这个问题是什么?

1 个解决方案

#1


3  

You should have, on your second computer, a ~/.ssh/config file with:

你应该在你的第二台电脑上安装一个~/。ssh / config文件:

host gitolite-raspberry
     user git
     hostname raspberry
     identityfile ~/.ssh/raspberry

(See, for instance, "Can not add user with Gitolite")

(例如,“不能添加使用Gitolite的用户”)

You need to check if ssh gitolite-raspberry answers you with the Gitolite rights associated with the raspberry ssh account.

您需要检查ssh Gitolite -raspberry是否响应与raspberry ssh帐户相关的Gitolite权限。

If not, ssh -vvv gitolite-raspberry will provide you with clues.

如果没有,ssh -vvv gitolite-raspberry将为您提供线索。


The OP Andrew M reports a right issue:

OP Andrew M报告了一个正确的问题:

I didn't set the permissions of the folder I was cloning into, so I "sudoed" the git command.
The root user on the Raspberry Pi wasn't allowed to clone, so it failed.

我没有设置要克隆到的文件夹的权限,所以我“sudoed”了git命令。树莓派上的根用户不允许克隆,所以失败了。

#1


3  

You should have, on your second computer, a ~/.ssh/config file with:

你应该在你的第二台电脑上安装一个~/。ssh / config文件:

host gitolite-raspberry
     user git
     hostname raspberry
     identityfile ~/.ssh/raspberry

(See, for instance, "Can not add user with Gitolite")

(例如,“不能添加使用Gitolite的用户”)

You need to check if ssh gitolite-raspberry answers you with the Gitolite rights associated with the raspberry ssh account.

您需要检查ssh Gitolite -raspberry是否响应与raspberry ssh帐户相关的Gitolite权限。

If not, ssh -vvv gitolite-raspberry will provide you with clues.

如果没有,ssh -vvv gitolite-raspberry将为您提供线索。


The OP Andrew M reports a right issue:

OP Andrew M报告了一个正确的问题:

I didn't set the permissions of the folder I was cloning into, so I "sudoed" the git command.
The root user on the Raspberry Pi wasn't allowed to clone, so it failed.

我没有设置要克隆到的文件夹的权限,所以我“sudoed”了git命令。树莓派上的根用户不允许克隆,所以失败了。