git 我必须如何配置 gitweb 和 gitolite 才能让它们一起工作?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7216176/
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
How do I have to configure gitweb and gitolite so they'll work together?
提问by Jee
I am trying to make gitweb work with gitolite... but unsuccessful so far.
I am working on a RedHat Linux machine. A user called git
exists.
我试图让 gitweb 与 gitolite 一起工作......但到目前为止没有成功。
我在 RedHat Linux 机器上工作。git
存在名为的用户。
gitolite is installed under: /home/git
Repository location: /home/git/repositories
gitolite 安装在:/home/git
存储库位置:/home/git/repositories
Please note that, gitweb was working fine with plain vanilla git. Now i am trying to make it work with gitolite.
请注意,gitweb 与普通的 vanilla git 一起工作得很好。现在我正试图让它与 gitolite 一起工作。
Here are what my files look like:
这是我的文件的样子:
/etc/gitweb.conf
$projectroot = "/home/git/repositories"; @git_base_url_list = qw(ssh://[MyHostName]/home/git/projects.list); $projects_list = "/home/git/projects.list"
/home/git/projects.list
myrepo1.git myrepo2.git
/home/git/.gitolite.rc
:$PROJECTS_LIST = $ENV{HOME} . "/projects.list"; $GL_GITCONFIG_KEYS = "gitweb.url receive.denyNonFastforwards receive.denyDeletes";
/etc/gitweb.conf
$projectroot = "/home/git/repositories"; @git_base_url_list = qw(ssh://[MyHostName]/home/git/projects.list); $projects_list = "/home/git/projects.list"
/home/git/projects.list
myrepo1.git myrepo2.git
/home/git/.gitolite.rc
:$PROJECTS_LIST = $ENV{HOME} . "/projects.list"; $GL_GITCONFIG_KEYS = "gitweb.url receive.denyNonFastforwards receive.denyDeletes";
What configuration have I missed? I have not made any changes to Apache.
我错过了什么配置?我没有对 Apache 进行任何更改。
Web URL: http://MyHostName/git
This gives a 404 error saying - No repositories found.
Web URL:http://MyHostName/git
这给出了一个 404 错误说 - No repositories found。
回答by Adam Sharp
I recently set up gitolite and gitweb and found that /etc/gitweb.conf
required verylittle configuration. What you have looks right to me. What are the permissions like on /home/git/repositories
? You may find they are too restrictive. Try this out:
我最近成立了gitolite和GitWeb里,发现/etc/gitweb.conf
需要非常少的配置。你所拥有的在我看来是正确的。权限如何/home/git/repositories
?您可能会发现它们过于严格。试试这个:
$ chmod -R 775 /home/git/repositories
That's what solved the issue for me, (though I imagine there's a more secure way to set up the permissions). If that works, I'd recommend just having a look into giving Apache (or whatever user account gitweb is being executed under) more fine-grained permissions over the repositories directory.
这就是为我解决问题的原因(尽管我想有一种更安全的方式来设置权限)。如果可行,我建议您只考虑为 Apache(或在其下执行的任何用户帐户 gitweb)提供对存储库目录的更细粒度的权限。
I also have this in my .gitolite.rc
:
我也有这个.gitolite.rc
:
GIT_CONFIG_KEYS => 'gitweb\.(owner|description|category)',
so that the following works in <gitolite-admin>/conf/gitolite.conf
:
以便以下工作<gitolite-admin>/conf/gitolite.conf
:
config gitweb.owner = owner name
config gitweb.description = some description
config gitweb.category = some category
回答by VonC
You need to add the Gitolite contrib/gitweb.conf
at the end of /etc/gitweb_config.perl
.
In other words, you need to call a Gitolite function from your gitweb.conf
perl file, otherwise the integration GitWeb-Gitolite will never work.
您需要添加Gitolitecontrib/gitweb.conf
在年底/etc/gitweb_config.perl
。
换句话说,您需要从您的gitweb.conf
perl 文件中调用 Gitolite 函数,否则集成 GitWeb-Gitolite 将永远无法工作。
# check for (at least) "R" permission
my ($perm, $creator) = &repo_rights($repo);
return ($perm =~ /R/);
(here repo_rights
is a method from gitolite.pm)
(这repo_rights
是来自gitolite.pm的方法)
Check the section "helping with gitweb".
检查“帮助使用 gitweb”部分。
The last lines you need to add at then end of gitweb_config.perl
are:
您需要在最后添加的最后几行gitweb_config.perl
是:
use lib (".");
require "gitweb.conf.pl";
That way, you will avoid any "500 - Internal Server Error syntax error at /etc/gitweb.conf
" error message.
这样,您将避免任何“ 500 - Internal Server Error syntax error at /etc/gitweb.conf
”错误消息。
If you don't have a gitweb_config.perl
in which you declare gitweb.conf.pl
, but directly "gitweb.conf.pl
", then add "use lib (".");
" as the first line of that file.
如果您没有gitweb_config.perl
在其中声明gitweb.conf.pl
,而是直接使用“ gitweb.conf.pl
”,则添加“ use lib (".");
”作为该文件的第一行。
回答by helvete
1/ install gitolite
and set it up. Then it suffices to make sure /home/git/.gitolite.rc
contains uncommented parts that look like:
1/ 安装gitolite
并设置它。然后确保/home/git/.gitolite.rc
包含如下所示的未注释部分就足够了:
%RC = (
...
UMASK => 0027,
...
ENABLE => [
...
'gitweb',
...
]
);
2/ set correctly $projectroot
and $projects_list
directives of /etc/gitweb.conf
(to match location of projects.list
file and repositories
dir). Like:
2/ 正确设置$projectroot
和$projects_list
指令/etc/gitweb.conf
(匹配projects.list
文件和repositories
目录的位置)。喜欢:
$projectroot = "/home/git/repositories";
...
$projects_list = "/home/git/projects.list";
3/ Make sure current repository files are also readable by webserver user. These examples are from debian based systems, so YMMV:
3/ 确保网络服务器用户也可以读取当前的存储库文件。这些示例来自基于 debian 的系统,所以 YMMV:
sudo adduser www-data git # append `www-data` user to a `git` group
sudo chmod g+r /home/git/projects.list # make sure group members can read the `project.list`
sudo chmod -R g+rx /home/git/repositories # recursively set less restrictive access mode for group members
sudo /etc/init.d/apache2 restart # restart web server to apply these changes
4/ Finally configure access for gitweb
user within your /conf/gitolite.conf
file of gitolite-admin
repository on a client machine and apply them by committing and pushing them (the standard way). A repository we would like to see and manage via gitweb
has to have the access set like this:
4/ 最后在客户端机器上的存储库文件中为gitweb
用户配置访问权限,并通过提交和推送它们(标准方式)来应用它们。我们希望通过其查看和管理的存储库必须具有如下访问权限:/conf/gitolite.conf
gitolite-admin
gitweb
repo testing
RW+ = @all
R = gitweb # add this line to make the repo browsable using `gitweb`
Note: The ...
only suggests there are other configuration directives within the files. Do not put them there!
注意:...
唯一的建议是文件中还有其他配置指令。不要把它们放在那里!
No other chages are necessary to make gitlab
visualize the gitolite
repositories.
无需其他更改即可使存储库gitlab
可视化gitolite
。
Applies (at least) for gitolite
3.6.6 and gitweb
2.1.4
适用于(至少)gitolite
3.6.6 和gitweb
2.1.4