“GitWeb”的版本间的差异

来自wrc's Wiki
跳到导航 跳到搜索
(建立内容为“在 Ubuntu 服务器中使用 GitWeb。 sudo apt install highlight fcgiwrap git == Nginx 配置 == 使用本配置时克隆地址为 <code><nowiki>htt…”的新页面)
 
 
第38行: 第38行:
  
 
配置文件为 <code>/etc/gitweb.conf</code>。
 
配置文件为 <code>/etc/gitweb.conf</code>。
 +
 +
Git 仓库存于 <code>/srv/git/projects</code>。
 +
 
<syntaxhighlight lang=perl>
 
<syntaxhighlight lang=perl>
 
# path to git projects (<project>.git)
 
# path to git projects (<project>.git)
$projectroot = "/srv/git";
+
$projectroot = "/srv/git/projects";
  
 
# directory to use for temp files
 
# directory to use for temp files

2021年4月25日 (日) 01:14的最新版本

Ubuntu 服务器中使用 GitWeb。

sudo apt install highlight fcgiwrap git

Nginx 配置

使用本配置时克隆地址为 https://git.example.com/clone/project

server {
    server_name git.example.com;

    location ~ /clone(/.*) {
        client_max_body_size 0;
        include /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
        fastcgi_param GIT_PROJECT_ROOT /srv/git;
        fastcgi_param PATH_INFO $1;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
    }

    location /gitweb.cgi {
        root /usr/share/gitweb;
        gzip off;
        include fastcgi_params;
        fastcgi_param SCRIPT_NAME $uri;
        fastcgi_param GITWEB_CONFIG /etc/gitweb.conf;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
    }
    location / {
        root /usr/share/gitweb;
        index gitweb.cgi;
    }
}

配置

配置文件为 /etc/gitweb.conf

Git 仓库存于 /srv/git/projects

# path to git projects (<project>.git)
$projectroot = "/srv/git/projects";

# directory to use for temp files
$git_temp = "/tmp";

# html text to include at home page
$home_text = "/srv/git/indextext.html";

# stylesheet to use
#@stylesheets = ("static/gitweb.css");

# javascript code for gitweb
#$javascript = "static/gitweb.js";

# logo to use
#$logo = "static/git-logo.png";

# the 'favicon'
#$favicon = "static/git-favicon.png";

# git-diff-tree(1) options to use for generated patches
#@diff_opts = ("-M");
@diff_opts = ();

# 不显示 owner
$omit_owner = 1;

# 只显示 bare repo 中有 "git-daemon-export-ok" 这个文件的仓库
$export_ok = "git-daemon-export-ok";

# 语法高亮(需要 highlight 包)
$feature{'highlight'}{'default'} = [1];

/srv/git/indextext.html 中写入需要在主页中额外添加的文字。

echo 'My personal git repos' | sudo tee /srv/git/indextext.html

外部链接