Cgit: Difference between revisions
No edit summary |
(Did an overhaul while preserving some of the wiki information about lighttpd) |
||
Line 1: | Line 1: | ||
[https://git.zx2c4.com/cgit/ 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. | |||
== Setting up cgit == | |||
Install the package that contains cgit and git. | |||
{{Cmd|apk add cgit git}} | |||
Open up /etc/cgitrc with your favorite editor, in this case is vim. | |||
{{Cmd|vim /etc/cgitrc}} | |||
== | If you want to show an specific repository your configuration should look something like this: | ||
{{Cat|/etc/cgitrc|<nowiki> | |||
{{Cmd|rc-service | virtual-root=/ | ||
repo.path=/var/lib/git/repositories/YOUR_GIT_REPO.git/ | |||
repo.url=CUSTOM_GIT_URL | |||
</nowiki> | |||
}} | |||
If you want to scan and show all the repositories you have, your configuration should look something like this: | |||
{{Cat|/etc/cgitrc|<nowiki> | |||
virtual-root=/ | |||
scan-path=/var/lib/git/repositories/ | |||
</nowiki> | |||
}} | |||
=== Run cgit using spawn-fcgi and fcgiwrap === | |||
Create a new service by doing a symbolic link. | |||
{{Cmd|ln -s /etc/init.d/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: | |||
{{Cat|/etc/conf.d/spawn-fcgi.cgit|<nowiki> | |||
FCGI_PROGRAM=/usr/bin/fcgiwrap | |||
</nowiki> | |||
}} | |||
Start the newly created service. | |||
{{Cmd|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. | |||
{{Cmd|apk add lighttpd}} | {{Cmd|apk add lighttpd}} | ||
Create a cgit.conf file into the lighttpd directory with the following content: | Create a cgit.conf file into the lighttpd directory with the following content: | ||
{{Cat|/etc/lighttpd/cgit.conf|<nowiki>server.modules += ("mod_redirect", | {{Cat|/etc/lighttpd/cgit.conf|<nowiki> | ||
server.modules += ("mod_redirect", | |||
"mod_alias", | "mod_alias", | ||
"mod_cgi", | "mod_cgi", | ||
Line 37: | Line 66: | ||
}} | }} | ||
Restart the lighttpd service. | |||
{{Cmd|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. | |||
{{Cmd|apk add nginx}} | |||
{{ | Create a custom configuration in the NGINX's conf.d directory. | ||
{{Cmd|vim /etc/nginx/conf.d/git.your_domain.com.conf}} | |||
The file should look something like this: | |||
{{Cat|/etc/nginx/conf.d/git.your_domain.com.conf|<nowiki> | |||
server { | |||
{{Cat|/etc/ | server_name git.your_domain.com; | ||
root /usr/share/webapps/cgit; | |||
try_files $uri @cgit; | |||
location @cgit { | |||
include fastcgi_params; | |||
fastcgi_pass localhost:1234; | |||
fastcgi_param SCRIPT_FILE $document_root/cgit.cgi; | |||
fastcgi_param PATH_INFO $uri; | |||
fastcgi_param QUERY_STRING $args; | |||
} | |||
} | |||
</nowiki> | |||
}} | }} | ||
Restart the NGINX service. | |||
{{Cmd|rc-service nginx restart}} | |||
{{ | |||
[[Category:Server]] | [[Category:Server]] | ||
[[Category:Git]] | [[Category:Git]] |
Revision as of 06:06, 20 August 2019
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.
Setting up cgit
Install the package that contains cgit and git.
apk add cgit 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
Create a new service by doing a symbolic link.
ln -s /etc/init.d/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