git gitolite 存储库已创建,但 projects.list 为空

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8604302/
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-19 06:17:05  来源:igfitidea点击:

gitolite repository getting created but projects.list is empty

gitgitolitegitweb

提问by Mukesh Agarwal

i've installed and configured both gitolite and gitweb. gitolite works fine, all repositories and users work as expected.. but when i use gitweb, i see a 404 - no projects found. i went on to see that projects.list is empty. The permission of projects.list file is 640 and the user and group are same "git".

我已经安装并配置了 gitolite 和 gitweb。gitolite 工作正常,所有存储库和用户都按预期工作......但是当我使用 gitweb 时,我看到 404 - 没有找到项目。我继续看到 projects.list 是空的。projects.list 文件的权限是 640 并且用户和组是相同的“git”。

I'm guessing gitolite adds a new repository to projects.list as well, right? My project root is /home/git/repositories.

我猜 gitolite 也会向 projects.list 添加一个新存储库,对吗?我的项目根目录是 /home/git/repositories。

回答by Cascabel

Note: This has been reworked in newer versions of gitolite; here's the relevant documentation. You can still give read permissions to the special user "gitweb" as before, and you can also add lines like this to repos:

注意:这已在较新版本的 gitolite 中重新设计;这是相关文档。您仍然可以像以前一样为特殊用户“gitweb”授予读取权限,您还可以将这样的行添加到 repos:

config gitweb.owner         =   owner name
config gitweb.description   =   some description
config gitweb.category      =   some category

If at least one of those config parameters is set for a repo, it will be made accessible to gitweb.

如果为存储库设置了这些配置参数中的至少一个,则 gitweb 将可以访问它。

As before, "made accessible to gitweb" means "magically added to projects.list".

和以前一样,“gitweb 可访问”意味着“神奇地添加到 projects.list”。



Original answer:

原答案:

Gitolite sensibly defaults to the most restrictive permissions - no one can see a repository until you tell it to let them. This of course includes gitweb. In order for gitweb to see a repository, quoting the gitolite.conf documentation:

Gitolite 明智地默认为最严格的权限 - 除非您告诉它允许,否则没有人可以看到存储库。这当然包括 gitweb。为了让 gitweb 看到存储库,引用gitolite.conf 文档

Similarly, give read permission to gitweb to allow the gitweb CGI to show the repo. Something like this:

repo    foo bar baz
    R   =   gitweb

This gives you a quick way to offer multiple repos up for gitweb and/or daemon access.

However, setting a description for the project also enables gitweb permissions so you can do it that way if you want. Of course in this case you have to deal with each repo separately. Add lines like this to gitolite.conf:

foo = "some description"
bar = "some other description"
baz = "yet another description"

You can also specify an owner for gitweb to show, if you like; for example I might use:

gitolite "Sitaram Chamarty" = "fast, secure, fine-grained, access control for git"

类似地,授予 gitweb 读取权限以允许 gitweb CGI 显示 repo。像这样的东西:

repo    foo bar baz
    R   =   gitweb

这为您提供了一种为 gitweb 和/或守护程序访问提供多个存储库的快速方法。

但是,为项目设置描述也会启用 gitweb 权限,因此您可以根据需要这样做。当然,在这种情况下,您必须分别处理每个 repo。将这样的行添加到 gitolite.conf:

foo = "some description"
bar = "some other description"
baz = "yet another description"

如果您愿意,您还可以为 gitweb 指定一个所有者来显示;例如我可能会使用:

gitolite "Sitaram Chamarty" = "fast, secure, fine-grained, access control for git"

Gitolite only places repositories in projects.list if you've told it to make them available to gitweb via one of those methods. It'll use the owner and description to populate projects.list as well, so it's usually best to do it that way. Do note that if your web server is running as a different user from Gitolite, you'll need to make sure it somehow has access to the relevant directories, which are hidden from other users by default. There's some example documentation about more complex cases: gitolite-gitweb-http-backend

Gitolite 仅将存储库放置在 projects.list 中,前提是您已告诉它通过其中一种方法将它们提供给 gitweb。它还将使用所有者和描述来填充projects.list,因此通常最好这样做。请注意,如果您的 Web 服务器以与 Gitolite 不同的用户身份运行,则您需要确保它以某种方式可以访问相关目录,默认情况下这些目录对其他用户是隐藏的。有一些关于更复杂案例的示例文档:gitolite-gitweb-http-backend