Changes

From Amahi Wiki
Jump to: navigation, search
1,023 bytes added ,  17:00, 9 January 2021
no edit summary
{{NeedsUpdate}}
 
 
'''NOTE:''' There is a [http://www.amahi.org/apps/gitweb one-click app] currently in ALPHA being tested.
 
[http://git-scm.com/ Git] is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Every Git clone is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. Branching and merging are fast and easy to do. Coupled with [http://sourceforge.net/apps/trac/sourceforge/wiki/GitWeb%20repository%20browser Gitweb], provides a web interface for browsing your project.
 
This tutorial will show you how to install, create a repo, and browse that repo on your HDA.
== Setup==
<ul><li>Create web app ([http:[Advanced_Settings|Advanced Settings]] must be enabled on HDA)</li><ol><li>From the Dashboard main page, select '''Apps''' at the top.</li><li>Choose ''Webapps''</li><li>Select '''New Web App''' button at the bottom</wiki.amahi.orgli><li>Enter ''gitweb'' for the Name (ensure the path reflects the name correctly)</index.phpli><li>Choose '''Create'''</li><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<pre>Text=Alias /git /var/hda/web-apps/gitweb/htmlRewriteEngine OnRewriteRule ^git$ git/ [R]DirectoryIndex gitweb.cgiSetEnv GITWEB_CONFIG "/etc/gitweb.conf"AddHandler cgi-script .cgi</pre></li><li>Create web page to browse repository</li><pre>cd /var/hda/web-apps/gitwebecho '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">* <html><head><title>Your Page Title</title><meta http-equiv<nowiki>=</nowiki>"REFRESH" content<nowiki>=</nowiki>"0;url<nowiki>=</nowiki>http://gitweb/git/"></HEAD><BODY>Optional page text here.</BODY></HTML>' > html/index.htmlchown 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}}* Create public SSH key storage{{Code|cd /var</cachepre></git;li>mkdir .sshchmod 700 .sshtouch .ssh/authorized_keyschmod 600 .ssh/authorized_keyschown -R git:git .ssh/}}* <li>Create init script{{Code|vi '''/etc/init.d/git}}''' file and add the following<blockquotepre>{{Text|Text=#!/bin/sh
<nowiki>#</nowiki>
<nowiki>#</nowiki> Startup/shutdown script for Git Daemon
*)
echo $"Usage: $prog {start<nowiki>|</nowiki>stop<nowiki>|</nowiki>restart<nowiki>|</nowiki>status}"
exit 3
esac
exit $RETVAL}}</blockquotepre></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)<pre>git config --global user.name "MyHDA"service git start}}config --global user.email myhda@localhost</pre></li><li>Create temporary repository<pre>cd /var/cache/git/git init testcd test</pre></li><li>Add test file and a short description<pre>echo 'test' > READMEgit add READMEgit commit -a -m "initial README file"</pre></li>* <li>Create local repository{{Code|<pre>cd /var/cache/git/mkdir git clone test test.git
cd test.git
git init --barechown -R git:git ..push origin master</test.gitpre></}}li>* Add a short description{{Code|cd <li>Edit '''/var/cache/git/test/.git/echo "test test repo" > description}}* Configure user access{{Code|vi config}}''' and add the following at the bottom (change '''MyHDA''' as desired)<blockquotepre>{{Text|Text=[core] repositoryformatversion = 0 filemode = true bare = true [gitweb] owner = Your Name}}MyHDA</blockquotepre>* Create local repository and commit{{Code|mkdir ~</testli>cd ~/test && git initecho 'test' <li> READMEgit add READMEgit commit -m "initial README file"}}* Create SSH rsa public key{{Code|ssh-keygen -t rsa -C "admin@yourisp.com" -N amahi -f /var/cache/git/.ssh/authorized_keys}}* Push to the repository{{Code|git remote add origin git@git.yourisp.com:test.gitgit push origin master}}* Add to bottom of the configuration file{{Code|vi '''/etc/gitweb.conf}}''' file<blockquotepre>{{Text|Text=$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/;"}}</blockquotepre>* Create custom index.html file{{Code|cd /var/hda/web-apps/gitwebvi html/index.html}}<blockquote>{{Text|Text=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"li><htmlli>Copy web files and set permissions<headpre><title>Your Page Title<d /title><meta http-equiv="REFRESH" content="0;url=http:var/hda/gitweb-apps/git/"></HEAD>gitweb<BODY>Optional page text here.</BODY></HTML>}}</blockquote>* Copy web files and set permissions{{Code|cp -r /var/www/git/* htmlchown -R apache:users html}}* Modify the web app configuration file as follows{{Code|vi /etc</httpdpre></conf.d/####-gitweb.conf}}li><blockquoteli>Update local repository description{{Text|Text=Alias /git <pre>cd /var/hdacache/webgitsed -appsi '1d' test.git​/gitweb.git/htmldescriptionecho 'Test Repo' >> test.git​/RewriteEngine OnRewriteRule ^git$ .git/ [R]DirectoryIndex gitweb.cgiSetEnv GITWEB_CONFIG "description</etcpre></gitweb.conf"AddHandler cgi-script .cgili><li>Edit '''/etc/httpd/conf.d/git.conf ''' and replace with this text <pre><Directory /var/hda/web-apps/gitweb/html>
RewriteEngine On
RewriteBase /git/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) gitweb.cgi/$1 [QSA,L]
</Directory>}}</blockquotepre></li><li>Update permissions, remove temporary repository, and restart web server<pre>chown -R git.git /var/cache/git* Restart Apacherm -rf /var/cache/git/test{{Code|/etc/init.d/httpd restart}}</pre></li></ul>
==Complete==
That is it. Navigate to <nowiki>http://gitweb/git</nowiki> to browse the newly created repository.
==Optional==
You can add the Amahi repo by doing the following:
<pre>cd /var/cache/git
git clone git://git.amahi.org/amahi.git</pre>
==References==
[http://www.kutukupret.com/2010/03/26/hosting-your-own-git-repository-on-fedora-12/ Hosting your own Git Repository on Fedora 12]
 
[[Contribute_code|Contribute Code]]
12,424

edits