Thursday, April 02, 2015

Learning Git & Installing Gitlist

The company that i've worked for has tons of codes EVERYWHERE.
And using a file directory system guess it's not gonna work for them.

Introducing GIT....
Which i hope will be able to solve the problem... hahaha!

Install Debian
apt-get update
apt-get install php5 apache2 git

Now I will assume the following:
Path to my git is at : /home/code/

mkdir /home/code/
chmod -R 744 /home/code/
chown -R www-data:www-data /home/code/

Install gitlist ( Web for git )
http://gitlist.org/ or cd /var/www/ && wget "https://s3.amazonaws.com/gitlist/gitlist-0.5.0.tar.gz"
tar -zxf gitlist-0.5.0.tar.gz
cd /var/www/gitlist/
rm config.ini-example ( Or you can rename it to config.ini with the following contents )
nano config.ini
[git]
client = '/usr/bin/git' ; Your git executable path
default_branch = 'master' ; Default branch when HEAD is detached
repositories[] = '/home/code/' ; Path to your repositories
                                           ; If you wish to add more repositories, just add a new line

; WINDOWS USERS
;client = '"C:\Program Files (x86)\Git\bin\git.exe"' ; Your git executable path
;repositories[] = 'C:\Path\to\Repos\' ; Path to your repositories

; You can hide repositories from GitList, just copy this for each repository you want to hide
; hidden[] = '/home/git/repositories/BetaTest'

[app]
debug = false
cache = true
theme = "default"
title = ""
baseurl = 'http://localhost/gitlist';

; If you need to specify custom filetypes for certain extensions, do this here
[filetypes]
; extension = type
; dist = xml

; If you need to set file types as binary or not, do this here
[binary_filetypes]
; extension = true
; svh = false
; map = true

; set the timezone
[date]
; timezone = UTC
; format = 'd/m/Y H:i:s'

Lets enable mod-rewrite
a2enmod rewrite
For the .htaccess in /var/www/gitlist/, make sure the rewrite rule becomes /gitlist/index.php instead of the original index.php
root@gitlist:/var/www/gitlist# cat .htaccess
    Options -MultiViews +SymLinksIfOwnerMatch

    RewriteEngine On
    #RewriteBase /var/www/gitlist/

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ /gitlist/index.php/$1 [L,NC]
    order allow,deny
    deny from all

Make a directory called cache and chmod 777 to it
mkdir cache
chmod 777 /var/www/gitlist/cache/

chown -R www-data:www-data /var/www/gitlist/
/etc/init.d/apache2 restart

Lets init an empty git.
cd /home/code/
git init --bare my-project.git

No comments: