git 将用户添加到 Gitolite

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5668674/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 10:37:44  来源:igfitidea点击:

Adding users to Gitolite

gitsshgitolite

提问by Raphael

I'm trying to setup Gitolite but I'm running into a weird issue:

我正在尝试设置 Gitolite,但遇到了一个奇怪的问题:

When I add a new public key file for a new user (say raphaelcruzeiro.pub), giolite sends me the following warning on push:

当我为新用户添加新的公钥文件(比如 raphaelcruzeiro.pub)时,giolite 会在推送时向我发送以下警告:

remote: 
remote:         ***** WARNING *****
remote:         the following users (pubkey files in parens) do not appear in the config file:
remote: raphaelcruzeiro(raphaelcruzeiro.pub)

And when I try to clone a repository with this user, I get a permission denied:

当我尝试用这个用户克隆一个存储库时,我得到了一个权限被拒绝:

Cloning into gitolite-admin...
R access for gitolite-admin DENIED to raphaelcruzeiro
fatal: The remote end hung up unexpectedly

Am I missing something here? Where and how do I add the user to the configuration file?

我在这里错过了什么吗?我在哪里以及如何将用户添加到配置文件中?

Unfortunately Gitolite's documentation is rather vague on this matter.

不幸的是,Gitolite 的文档在这个问题上相当模糊。

回答by Darhuuk

Here's the workflow for adding users to gitolite:

以下是将用户添加到 gitolite 的工作流程:

Add the users public key to the map keysas <username>.pub

将用户公钥添加到地图keys<username>.pub

Edit your gitolite config file (gitolite.conf), this file is in the map conf. When you open it, everthing will be clear.

编辑您的 gitolite 配置文件 ( gitolite.conf),该文件位于地图中conf。当你打开它时,一切都会清楚。

example:

例子:

repo  someproject

  RW+ = darhuuk

  RW  = raphaelcruzeiro

  R   = santaclaus

Commit the new key and the modified config file. Then push it to your gitolite server.

提交新密钥和修改后的配置文件。然后将其推送到您的 gitolite 服务器。

That should do it!

应该这样做!

[Edit]BTW, here is the gitolite paragraph that explains what I wrote above: http://gitolite.com/gitolite/conf.html.

[编辑]顺便说一句,这是解释我上面写的内容的 gitolite 段落:http: //gitolite.com/gitolite/conf.html

回答by VonC

Note that the recent gitolite v3.5.2-10-g437b497 introduces (September 2013, commit 59c817d0):

请注意,最近的 gitolite v3.5.2-10-g437b497 引入了(2013 年 9 月,提交59c817d0):

ukm, for "user key management".

ukm,用于“用户密钥管理”

User key management allows certain users to add and remove keys.

用户密钥管理允许某些用户添加和删除密钥。

It introduces a level of delegation, when not just the gitolite admin user can add new ssh public keys, but other users can now do so as well.

它引入了一种授权级别,此时不仅 gitolite 管理员用户可以添加新的 ssh 公钥,其他用户现在也可以这样做。

You can see it in action in "contrib/t/ukm.t":

您可以在“ contrib/t/ukm.t”中看到它的运行情况:

You need to enable that feature:

您需要启用该功能:

# enable user key management in a simple form.
# Guest key managers can add keyids looking like email addresses, but
# cannot add emails containing example.com or hemmecke.org.
system("sed -i \"s/.*ENABLE =>.*/'UKM_CONFIG'=>{'FORBIDDEN_GUEST_PATTERN'=>'example.com|hemmecke.org'}, ENABLE => ['ukm',/\" $h/.gitolite.rc");