<li>[[Open_Terminal_as_root|Open a terminal as root]] user and do the following:
<li>Install dependencies
{{Code|<pre>yum -y install git git-daemon gitweb}}</pre></li>
<li>Look for the ''####-gitweb.conf'' in '''/etc/httpd/conf.d''' (#### is some number, i.e. 1000) file and open it in your favorite editor. Add text after '''ServerAlias''' line
{{Text|<pre>Text=Alias /git /var/hda/web-apps/gitweb/html
RewriteEngine On
RewriteRule ^git$ git/ [R]
DirectoryIndex gitweb.cgi
SetEnv GITWEB_CONFIG "/etc/gitweb.conf"
AddHandler cgi-script .cgi}}</pre></li>
<li>Create web page to browse repository</li>
{{Code|<pre>cd /var/hda/web-apps/gitweb
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
</BODY>
</HTML>' > html/index.html
chown apache.users html/index.html}}</pre></li>
</ol>
<li>Add user
{{Code|<pre>useradd -U -d /var/cache/git -s /usr/libexec/git-core/git-shell git}}</pre></li>
<li>Set directory permissions
{{Code|<pre>cd /var/cache
chown -R git:git git
chmod 755 git/}}</pre></li>
<li>Create '''/etc/init.d/git''' file and add the following
{{Text|Text=<pre>#!/bin/sh
<nowiki>#</nowiki>
<nowiki>#</nowiki> Startup/shutdown script for Git Daemon
esac
exit $RETVAL}}</pre></li>
<li>Set init script to run
{{Code|<pre>chmod 755 /etc/init.d/git;
/etc/init.d/git start
/sbin/chkconfig git on}}</pre></li>
<li>Set User information (change '''user.name''' and '''user.email''' accordingly)
{{Code|<pre>git config --global user.name "MyHDA"git config --global user.email myhda@localhost}}</pre></li>
<li>Create temporary repository
{{Code|<pre>cd /var/cache/git/
git init test
cd test}}</pre></li>
<li>Add test file and a short description
{{Code|<pre>echo 'test' > README
git add README
git commit -a -m "initial README file"}}</pre></li>
<li>Create local repository
{{Code|<pre>cd /var/cache/git/
git clone test test.git
cd test.git
git push origin master}}</pre></li>
<li>Edit '''/var/cache/git/test/.git/config''' and add the following at the bottom (change '''MyHDA''' as desired)
{{Text|Text=<pre>[gitweb] owner = MyHDA}}</pre></li>
<li>Add to bottom of '''/etc/gitweb.conf''' file
{{Text|Text=<pre>$feature{'blame'}{'default'} = [undef];
$feature{'pickaxe'}{'default'} = [undef];
$feature{'search'}{'default'} = [undef];
$feature{'pathinfo'}{'default'} = [1];
$my_uri = "http://gitweb/git/";
$home_link = "http://gitweb/git/;"}}</pre></li>
<li>Copy web files and set permissions
{{Code|cd <pre>d /var/hda/web-apps/gitweb
cp -r /var/www/git/* html
chown -R apache:users html/}}</pre></li>
<li>Update local repository description
{{Code|<pre>cd /var/cache/git
sed -i '1d' test.git/.git/description
echo 'Test Repo' >> test.git/.git/description}}</pre></li>
<li>Edit '''/etc/httpd/conf.d/git.conf''' and replace with this text
{{Text|Text=<pre><Directory /var/hda/web-apps/gitweb/html>
RewriteEngine On
RewriteBase /git/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) gitweb.cgi/$1 [QSA,L]
</Directory>}}</pre></li>
<li>Update permissions, remove temporary repository, and restart web server
{{Code|<pre>chown -R git.git /var/cache/git
rm -rf /var/cache/git/test
/etc/init.d/httpd restart}}</pre></li>
</ul>
==Optional==
You can add the Amahi repo by doing the following:
{{Code|<pre>cd /var/cache/gitgit clone git://git.amahi.org/amahi.git}}</pre>
==References==