Cgit: Difference between revisions
No edit summary |
m (→Installation: use pkg template.) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
{{Note|It is very recommendable that you already have a directory with an active .git working in your server. If you don't have one, install [[gitolite]] or a similar program before going further.}} | {{Note|It is very recommendable that you already have a directory with an active .git working in your server. If you don't have one, install [[gitolite]] or a similar program before going further.}} | ||
Install the package that contains cgit and git. | Install the package that contains cgit and git. | ||
{{Cmd|apk add cgit git}} | {{Cmd|apk add {{pkg|cgit|arch=}} {{pkg|git|arch=}}}} | ||
Open up /etc/cgitrc with your favorite editor, in this case is vim. | Open up /etc/cgitrc with your favorite editor, in this case is vim. | ||
Line 21: | Line 21: | ||
=== Run cgit using spawn-fcgi and fcgiwrap === | === Run cgit using spawn-fcgi and fcgiwrap === | ||
Install spawn-fcgi and fcgiwrap | |||
{{Cmd|apk add fcgiwrap spawn-fcgi}} | |||
Create a new service by doing a symbolic link. | Create a new service by doing a symbolic link. | ||
{{Cmd|ln -s spawn-fcgi /etc/init.d/spawn-fcgi.cgit}} | {{Cmd|ln -s spawn-fcgi /etc/init.d/spawn-fcgi.cgit}} | ||
Line 28: | Line 30: | ||
FCGI_PROGRAM=/usr/bin/fcgiwrap | FCGI_PROGRAM=/usr/bin/fcgiwrap | ||
</nowiki>}} | </nowiki>}} | ||
{{Note|You should consider using unix domain sockets instead.}} | |||
Start the newly created service. | Start the newly created service. | ||
{{Cmd|rc-service spawn-fcgi.cgit start}} | {{Cmd|rc-service spawn-fcgi.cgit start}} | ||
Line 80: | Line 83: | ||
include fastcgi_params; | include fastcgi_params; | ||
fastcgi_pass localhost:1234; | fastcgi_pass localhost:1234; | ||
fastcgi_param | fastcgi_param SCRIPT_FILENAME $document_root/cgit.cgi; | ||
fastcgi_param PATH_INFO $uri; | fastcgi_param PATH_INFO $uri; | ||
fastcgi_param QUERY_STRING $args; | fastcgi_param QUERY_STRING $args; |
Latest revision as of 05:36, 4 March 2024
cgit is a fast web-interface (CGI) for git written in the C programming language. It makes it possible for potential contributors to track and view project source code from the web instead of through a git client.
Installation
Install the package that contains cgit and git.
Open up /etc/cgitrc with your favorite editor, in this case is vim.
vim /etc/cgitrc
If you want to show an specific repository your configuration should look something like this:
Contents of /etc/cgitrc
If you want to scan and show all the repositories you have, your configuration should look something like this:
Contents of /etc/cgitrc
Run cgit using spawn-fcgi and fcgiwrap
Install spawn-fcgi and fcgiwrap
apk add fcgiwrap spawn-fcgi
Create a new service by doing a symbolic link.
ln -s spawn-fcgi /etc/init.d/spawn-fcgi.cgit
Create a configuration file called spawn-fcgi.cgit in /etc/conf.d/ ; the service will run fcgiwrap automatically everytime is called. It should look exactly like this:
Contents of /etc/conf.d/spawn-fcgi.cgit
Start the newly created service.
rc-service spawn-fcgi.cgit start
Run cgit with a web service
Configure Lighttpd to work with cgit
Install the package that contains lighttpd if you haven't already.
apk add lighttpd
Create a cgit.conf file into the lighttpd directory with the following content:
Contents of /etc/lighttpd/cgit.conf
Finally, add the following line to the lighttpd.conf file:
Contents of /etc/lighttpd/lighttpd.conf
Restart the lighttpd service.
rc-service lighttpd restart
Configure NGINX to work with cgit pointing to a subdomain
Install the package that contains NGINX if you haven't already.
apk add nginx
Create a custom configuration in the NGINX's conf.d directory.
vim /etc/nginx/conf.d/git.your_domain.com.conf
The file should look something like this:
Contents of /etc/nginx/conf.d/git.your_domain.com.conf
Restart the NGINX service.
rc-service nginx restart