Difference between revisions of "Cgit"

From Alpine Linux
Jump to: navigation, search
(/etc/cgitrc file)
(Lighttpd)
Line 6: Line 6:
  
 
==  Lighttpd ==
 
==  Lighttpd ==
[[Lighttpd]]
+
Make sure that [[Lighttpd]] is already installed.
 +
{{Cmd|rc-service lighttpd status}}
 +
You will receive the lighttpd status as '''stopped''' or '''started''' if it is already installed. If you receive the answer: '''service `lighttpd' does not exist.''' issue the command below:
 +
{{Cmd|apk add lighttpd}}
 +
 
 +
Create a cgit.conf file into the lighttpd directory with the following content:
 +
{{Cat|/etc/lighttpd/cgit.conf|<nowiki>server.modules += ("mod_redirect",
 +
                  "mod_alias",
 +
                  "mod_cgi",
 +
                  "mod_fastcgi",
 +
                  "mod_rewrite" )
 +
 
 +
var.webapps  = "/usr/share/webapps/"
 +
$HTTP["url"] =~ "^/cgit" {
 +
    server.document-root = webapps
 +
    server.indexfiles = ("cgit.cgi")
 +
    cgi.assign = ("cgit.cgi" => "")
 +
    mimetype.assign = ( ".css" => "text/css" )
 +
}
 +
url.redirect = (
 +
    "^/git/(.*)$" => "/cgit/cgit.cgi/$1",
 +
)
 +
</nowiki>
 +
}}
 +
 
 +
Finally, add the following line to the lighttpd.conf file:
 +
{{Cat|/etc/lighttpd/lighttpd.conf|<nowiki>include=cgit.conf
 +
</nowiki>
 +
}}
  
 
== cgit ==
 
== cgit ==

Revision as of 19:47, 8 August 2014

Underconstruction clock icon gray.svg
This material is work-in-progress ...

Do not follow instructions here until this notice is removed.
(Last edited by Alacerda on 8 Aug 2014.)

cgit is a CGI-application that was written in C and a web interface for git repositories provides.

Running instance: git.alpinelinux.org

Lighttpd

Make sure that Lighttpd is already installed.

rc-service lighttpd status

You will receive the lighttpd status as stopped or started if it is already installed. If you receive the answer: service `lighttpd' does not exist. issue the command below:

apk add lighttpd

Create a cgit.conf file into the lighttpd directory with the following content:

Contents of /etc/lighttpd/cgit.conf

server.modules += ("mod_redirect", "mod_alias", "mod_cgi", "mod_fastcgi", "mod_rewrite" ) var.webapps = "/usr/share/webapps/" $HTTP["url"] =~ "^/cgit" { server.document-root = webapps server.indexfiles = ("cgit.cgi") cgi.assign = ("cgit.cgi" => "") mimetype.assign = ( ".css" => "text/css" ) } url.redirect = ( "^/git/(.*)$" => "/cgit/cgit.cgi/$1", )

Finally, add the following line to the lighttpd.conf file:

Contents of /etc/lighttpd/lighttpd.conf

include=cgit.conf

cgit

Install cgit

apk add cgit git

Initialize a sample git repository

git init --bare /var/git/sample.git

Edit the /etc/cgitrc file:

vi /etc/cgitrc

And make sure you have at least the following lines:

Contents of /etc/cgitrc

scan-path=/var/git/ enable-git-config=1

Uncomment this line, if you want to store the repository in its own file

include=/etc/cgitrepos

Create the file

touch /etc/cgitrepos

Now add every repository

repo.url=sample
repo.path=/var/git/sample.git
repo.desc=Sample master foo repository
repo.owner=sample@example.com
repo.readme=info/web/about.html

If you want to group your repositories, add the every repository to a group.

repo.group=Sample group