HOW TO INSTALL CGIT ON GITSERVER (DEBIAN)
##########################################

THIS GOES OFF THE ARTICLE OF HOW TO SETUP A GITSERVER:  here

WHAT IS THIS:
CGIT IS A WEB INTERFACE FOR THE GIT SERVER YOU HAVE. HERE IS AN EXAMPLE OF ONE http://git.zx2c4.com/cgit/
THAT EXAMPLE IS ALSO THE MAIN SITE TO DOWNLOAD THE APP

THIS IS ON DEBIAN

PREQS:
apt-get -y install apache2 # SKIP THIS IF YOU HAVE APACHE
apt-get -y install unzip
apt-get -y install git curl bzip2

NOTE: from now on all commands are begun with #, with exception of things inside the ‘CONTENTS:’ sections as those are file contents, and anything with # in there is a comment.
NOTE: all of the configs here are for cgit to run off http not https

FIRST METHOD
=============

go to http://git.zx2c4.com/cgit/
get latest cgit version under tag section
get its url

# cd /root/
# wget http://git.zx2c4.com/cgit/snapshot/cgit-0.9.2.zip
# unzip cgit*
# cd cgit*

OR INSTEAD

SECOND METHOD
=============

# git clone git://hjemli.net/pub/git/cgit
# cd cgit
# git submodule init
# git submodule update

OR INSTEAD

THIRD METHOD
============

# git clone git://git.zx2c4.com/cgit
# cd cgit
# git submodule init
# git submodule update
AFTER (FIRST,SECOND,or THIRD METHOD)
===================================

# make get-git
# make
# make install

NOTE IT INSTALLS cgit TO /var/www/htdocs/cgit/ – THE MAIN FILE THERE IS cgit.cgi WHICH IS THE CGI PROGRAM.

I HAVE DEBIAN SO APACHE2 IS LOCATED AT /etc/apache2 WE NEED TO MAKE A CONFIG FILE INTO THE conf.d FOLDER WHICH IS GOOD FOR MODULE TYPE OF APACHE CONFIG (MODULE BASICALLY YOU CAN TAKE IT ON AND OFF, IT DOESNT HAVE TO BE PART OF THE MAIN APACHE CONFIG FILE – EVERYTHING INSIDE THE conf.d FOLDER IS INCLUDED BECAUSE OF apache2.conf) – NOTE IT DOESNT EXIST AT FIRST, THE VI COMMAND MAKES IT

vi /etc/apache2/conf.d/cgit

CONTENTS:

<Directory /var/www/htdocs/cgit>
AllowOverride None
Options +ExecCGI
AddHandler cgi-script .cgi
Order allow,deny
Allow from all
DirectoryIndex cgit.cgi
</Directory>
# Alias /cgit.png /var/www/htdocs/cgit/cgit.png
# Alias /cgit.css /var/www/htdocs/cgit/cgit.css
# Alias /cgit /var/www/htdocs/cgit/cgit.cgi/
Alias /cgit /var/www/htdocs/cgit/

END OF CONTENTS (DONT INCLUDE THIS LINE)

NOTE I DIDNT USE LOTS OF THE ALIASES I SAW ON THE OTHER TUTORIALS, THOSE DIDNT WORK FOR ME

NOW MY cgit CONFIG FILE WHICH IS CALLED /etc/cgitrc – NOTE IT DOESNT EXIST AT FIRST, THE VI COMMAND MAKES IT

vi /etc/cgitrc

CONTENTS:

# cgit config
css=/cgit/cgit.css
logo=/cgit/cgit.png
# if you don’t want that webcrawler (like google) index your site
robots=noindex, nofollow
## and included like this:
## include=/etc/cgitrepos
repo.url=hr-git
repo.path=/opt/git/hr
repo.desc=human readable
repo.owner=boss@infotinks.com
# if had another module – it would be added like so
# repo.url=OSGi-module
# repo.path=/home/git/repositories/OSGi-module.git
# repo.desc=the OSGi-module repository
# repo.owner=foo@bar.com

END OF CONTENTS (DONT INCLUDE THIS LINE)

AFTER THAT LETS RESTART APACHE2

# service apache2 restart;

OR

# /etc/init.d/apache2 restart

NOW ACCESS YOUR WEBSERVER WITH THESE FOLDERS:

URL: www.webserver.com/cgit

ALSO CAN

URL: www.webserver.com/htdoc/cgit

MONITOR APACHE AS YOU TRY TO GO TO

# tail -f /var/log/apache2/access.log -f /var/log/apache2/error.log

 
NOTE FOR ME THE LAST PART IS DIFFERENT
#######################################

I access mine like this:

URL: www.mysite.com:50500/cgit

or

URL: www.mysite.com:50500/htdocs/cgit

My server is configured alittle bit different, it runs on port 50500 so it looks like this. You can use this as a template for your server if it runs on different ports. So my http (not https) is running on 50500 instead of 80. My https is still running on 443 as i didnt edit it.

NOTE: all of the configs here are for cgit to run off http not https

The main apache2 files are changed in a couple places

CONFIG: /etc/apache2/sites-available/default

and the other one is

CONFIG: /etc/apache2/ports.conf

you will see this has other changes because I have a personal ‘secure’ folder where I use WebDAV, completely unrelated and can be left out in your config

DEFAULT CONFIG FILE
===================

root@debikos71:/var/www# cat /etc/apache2/sites-available/default
<VirtualHost *:50500>
ServerAdmin webmaster@localhost

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /var/www/secure>
DAV On
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory “/usr/lib/cgi-bin”>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

PORTS CONFIG FILE
==================

root@debikos71:/var/www# cat /etc/apache2/ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

NameVirtualHost *:50500
Listen 50500

<IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
Listen 443
</IfModule>

<IfModule mod_gnutls.c>
Listen 443
</IfModule>

NOT IF YOU WERE CURIOUS AT WHATS INSIDE /opt/git/hr
####################################################

This is where my main git is, this is my ‘hr’ app im working on

Note this is the folder which start when you init a project on git

# find
.
./hr
./branches
./info
./info/exclude
./description
./objects
./objects/7f
./objects/7f/ec74566bb3160b7719fa5cc80e28b673479cb7
./objects/d0
./objects/d0/9ba3e988b91ae11501f99f813ad651c2e1030f
./objects/f1
./objects/f1/ceac8e6ff903de8433507176f5be16edad5d02
./objects/info
./objects/66
./objects/66/840af05958ece50616fc65e4a1157b5f8e73d4
./objects/0b
./objects/0b/fbd2e1dbe6b1d08a1712bda74c34ea5cba78f8
./objects/0b/1f4a22c2bb175ffbc241e2499dcbe92f2e89c3
./objects/dc
./objects/dc/d640b0d04435595d7b5b0586f900686b1adfb6
./objects/30
./objects/30/f0770924a7b9fc5bc815725b494b97e29e0844
./objects/41
./objects/41/71f204c589959b2d65ad41f1404b7ca709f387
./objects/41/724a62663e3b192089dcdaac982b8451ecf958
./objects/be
./objects/be/41bc93b17b0b0a58ad06c2090a03b8ce64720f
./objects/26
./objects/26/16adcbf1417c5d2bc20226f20aed3a35e521c0
./objects/pack
./objects/ca
./objects/ca/4c0c278887c5ce7adbb9c80919cb86e2836269
./objects/71
./objects/71/60395b2f0a0c22d77865eb8983ddb8ccb16d44
./objects/80
./objects/80/e5659a601126e302fbbf069e27ac111e89ebc5
./objects/47
./objects/47/f79f268c45aa7c4999c67fa1798488bfa2609f
./objects/da
./objects/da/b76c2e891d5d72278221eff360a72bba8f82af
./objects/6e
./objects/6e/2aa0074323d38174558dc800cf36cfa8b443aa
./HEAD
./refs
./refs/heads
./refs/heads/master
./refs/tags
./hooks
./hooks/pre-applypatch.sample
./hooks/commit-msg.sample
./hooks/pre-commit.sample
./hooks/pre-rebase.sample
./hooks/prepare-commit-msg.sample
./hooks/update.sample
./hooks/applypatch-msg.sample
./hooks/post-update.sample
./config

One thought on “cgit – HOW TO INSTALL CGIT ON GITSERVER

Leave a Reply

Your email address will not be published. Required fields are marked *