Differences between revisions 1 and 9 (spanning 8 versions)
Revision 1 as of 2020-06-11 19:17:09
Size: 630
Comment:
Revision 9 as of 2023-04-22 20:22:09
Size: 2526
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

'''CGit''' is a minimal, lightweight web interface for git repositories.

Naturally, the upstream team uses [[https://git.zx2c4.com/cgit/|a CGit instance]] for development of CGit.
Line 9: Line 13:
== Clone URLs == == Installation ==
Line 11: Line 15:
First, enable HTTP cloning in your `cgitrc`. Most [[Linux]] and [[BSD]] distributions offer a `cgit` package.

----



== Configuration ==

CGit itself is configured with a `cgitrc(5)` file.




=== FastCGI ===

CGit is a [[Protocols/CGI|CGI]] program and depends on a FastCGI server.

For a simple setup, consider [[Nginx/FastCGI#Spawn-fcgi|nginx(8), fcgiwrap(8), and spawn-fcgi(1)]]. The `nginx(8)` server configuration would look like:

{{{
server {
  listen 80;
  server_name git.example.com;
  root /var/www;
  try_files $uri @cgit;

  location @cgit {
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root/cgit.cgi;
    fastcgi_param PATH_INFO $uri;
    fastcgi_param QUERY_STRING $args;
    fastcgi_param HTTP_HOST $server_name;

    fastcgi_pass unix:/run/fcgiwrap.sock;
  }
}
}}}



=== HTTP(S) Cloning ===

Enable HTTP cloning within CGit.
Line 17: Line 63:
Second, insert a space-delimited list of URLs to each repository configuration. SSH clone instructions can be included, though be aware-a ''port'' cannot be specified with a ''relative path''. The maximal options are one of `user@ip:port/absolute/path/to/my-repo.git` and `user@ip:relative/path/to/my-repo.git`. Configure each repository with a space-delimited list of URLs.
Line 25: Line 71:
SSH clone instructions can be included, but ports are incompatible with relative paths. In other words, `[email protected]:port/absolute/path/to/repo.git` and `[email protected]:relative/path/to/repo.git` ''are'' valid but `[email protected]:8022relative/path/to/repo.git` is ''not''.



=== Custom CSS ===

CGit is typically packaged with an official stylesheet used by upstream. The default `cgitrc(5)` file sets the stylesheet using:

{{{
css=/cgit.css
}}}

Note that this is a URL, not a filesystem path.

To include an HTML file into the head of the generated web page, use the `head-include` option in `cgitrc`.

{{{
head-include=/path/to/my/head.html
}}}



=== Custom Headers and Footers ===

To include an HTML file into the body of the generated web page, use one of the `header` or `footer` options in `cgitrc`.

{{{
header=/path/to/my/header.html
footer=/path/to/my/footer.html
}}}

This is most commonly used to insert a logo, contact and copyright information, or domain navigation.

----



== See also ==

[[https://man.archlinux.org/man/community/cgit/cgitrc.5.en|cgitrc(5)]]

CGit

CGit is a minimal, lightweight web interface for git repositories.

Naturally, the upstream team uses a CGit instance for development of CGit.


Installation

Most Linux and BSD distributions offer a cgit package.


Configuration

CGit itself is configured with a cgitrc(5) file.

FastCGI

CGit is a CGI program and depends on a FastCGI server.

For a simple setup, consider nginx(8), fcgiwrap(8), and spawn-fcgi(1). The nginx(8) server configuration would look like:

server {
  listen 80;
  server_name git.example.com;
  root /var/www;
  try_files $uri @cgit;

  location @cgit {
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root/cgit.cgi;
    fastcgi_param PATH_INFO $uri;
    fastcgi_param QUERY_STRING $args;
    fastcgi_param HTTP_HOST $server_name;

    fastcgi_pass unix:/run/fcgiwrap.sock;
  }
}

HTTP(S) Cloning

Enable HTTP cloning within CGit.

enable-http-clone=1

Configure each repository with a space-delimited list of URLs.

repo.name=my-repo
repo.path=my-repo.git
repo.clone-url=https://git.my-server.com/my-repo [email protected]/my-repo.git

SSH clone instructions can be included, but ports are incompatible with relative paths. In other words, [email protected]:port/absolute/path/to/repo.git and [email protected]:relative/path/to/repo.git are valid but [email protected]:8022relative/path/to/repo.git is not.

Custom CSS

CGit is typically packaged with an official stylesheet used by upstream. The default cgitrc(5) file sets the stylesheet using:

css=/cgit.css

Note that this is a URL, not a filesystem path.

To include an HTML file into the head of the generated web page, use the head-include option in cgitrc.

head-include=/path/to/my/head.html

Custom Headers and Footers

To include an HTML file into the body of the generated web page, use one of the header or footer options in cgitrc.

header=/path/to/my/header.html
footer=/path/to/my/footer.html

This is most commonly used to insert a logo, contact and copyright information, or domain navigation.


See also

cgitrc(5)


CategoryRicottone

CGit (last edited 2023-04-22 20:22:09 by DominicRicottone)