Gitweb - 404 - 找不到项目
Gitweb - 404 - No projects found
我有一个带有 Centos 7 的 DigitalOcean Droplet,但我在我的 Droplet 上看不到我的存储库。
我有一个用户 git
,在各自的主文件夹中我有文件夹 "projects":/home/git/projects
该文件夹内是一个测试回购,初始化为:git init --bare
这是我的 gitweb.conf
$projectroot = "/home/git/projects";
$git_temp = "/tmp";
$home_link = $my_uri || "/";
$home_text = "indextext.html";
$projects_list = $projectroot;
这是我的站点可用文件:
server {
listen 80;
server_name git.apselom.com;
access_log /var/log/nginx/git.apselom.com.access_log main;
error_log /var/log/nginx/git.apselom.com.error_log info;
location /gitweb.cgi {
root /var/www/git/;
include fastcgi_params;
gzip off;
fastcgi_param SCRIPT_NAME $uri;
fastcgi_param GITWEB_CONFIG /etc/gitweb.conf;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
location / {
root /var/www/git/;
index gitweb.cgi;
}
}
有了这些,我只得到错误:404 - No projects found
。
我怀疑问题是您的 Web 服务器的用户 运行 无法访问您的 git 存储库。
奇怪的是,您说您使用的是 CentOS 7,但 CentOS 7 附带 Apache httpd,而您拥有的看起来像是 Lighttpd 配置。 CentOS 的 gitweb
软件包附带一个 Apache 配置文件,因此使用它基本上是:
安装包:
yum install gitweb httpd
创建您的 git
用户并确保 apache
用户能够访问以下内容:
# useradd -c 'git user' git
# usermod -a -G git apache
# su - git <<EOF
mkdir projects
git init --bare projects/project1
git init --bare projects/project2
EOF
# chmod -R g+rwX /home/git
编辑 /etc/gitweb.conf
以指向项目目录:
our $projectroot = "/home/git/projects";
启动网络服务器:
systemctl enable httpd
systemctl start httpd
你可以开始了:
$ links http://localhost/git/
[...]
Project Description Owner Last Change
project1 Unnamed repository; edit this... git user No commits summary | shortlog | log |
tree
project2 Unnamed repository; edit this... git user No commits summary | shortlog | log |
tree
不过,关键部分是确保您的 Web 服务器对 /home/git
目录具有适当的权限。如果您不使用 Apache,请找出您的网络服务器使用的用户,然后在上面替换它。
您可以轻松地将 apache 添加到 git 组。
usermod -a -G git apache
我有一个带有 Centos 7 的 DigitalOcean Droplet,但我在我的 Droplet 上看不到我的存储库。
我有一个用户 git
,在各自的主文件夹中我有文件夹 "projects":/home/git/projects
该文件夹内是一个测试回购,初始化为:git init --bare
这是我的 gitweb.conf
$projectroot = "/home/git/projects";
$git_temp = "/tmp";
$home_link = $my_uri || "/";
$home_text = "indextext.html";
$projects_list = $projectroot;
这是我的站点可用文件:
server {
listen 80;
server_name git.apselom.com;
access_log /var/log/nginx/git.apselom.com.access_log main;
error_log /var/log/nginx/git.apselom.com.error_log info;
location /gitweb.cgi {
root /var/www/git/;
include fastcgi_params;
gzip off;
fastcgi_param SCRIPT_NAME $uri;
fastcgi_param GITWEB_CONFIG /etc/gitweb.conf;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
location / {
root /var/www/git/;
index gitweb.cgi;
}
}
有了这些,我只得到错误:404 - No projects found
。
我怀疑问题是您的 Web 服务器的用户 运行 无法访问您的 git 存储库。
奇怪的是,您说您使用的是 CentOS 7,但 CentOS 7 附带 Apache httpd,而您拥有的看起来像是 Lighttpd 配置。 CentOS 的 gitweb
软件包附带一个 Apache 配置文件,因此使用它基本上是:
安装包:
yum install gitweb httpd
创建您的
git
用户并确保apache
用户能够访问以下内容:# useradd -c 'git user' git # usermod -a -G git apache # su - git <<EOF mkdir projects git init --bare projects/project1 git init --bare projects/project2 EOF # chmod -R g+rwX /home/git
编辑
/etc/gitweb.conf
以指向项目目录:our $projectroot = "/home/git/projects";
启动网络服务器:
systemctl enable httpd systemctl start httpd
你可以开始了:
$ links http://localhost/git/
[...]
Project Description Owner Last Change
project1 Unnamed repository; edit this... git user No commits summary | shortlog | log |
tree
project2 Unnamed repository; edit this... git user No commits summary | shortlog | log |
tree
不过,关键部分是确保您的 Web 服务器对 /home/git
目录具有适当的权限。如果您不使用 Apache,请找出您的网络服务器使用的用户,然后在上面替换它。
您可以轻松地将 apache 添加到 git 组。
usermod -a -G git apache