hope you already have apache2 installed and its conf are in
/etc/apache2/
copied from
Install Git packages as needed
$ sudo apt-get install it git-core gitk gitweb if your apache www directory is pointing to ~/www $ cd ~/www/ $ mkdir gitweb $ cd gitweb
copying gitwebfiles to local www
$ cp /usr/share/gitweb/* ~/www/gitweb check the index.cgi has the cgi code in it
add gitweb directory to apache2 configuration by creating a “gitweb” file inside apache conf.d directory:
$ nano /etc/apache/conf.d/gitweb Alias /gitweb /home/roger/www/gitweb
Options FollowSymLinks +ExecCGI AddHandler cgi-script .cgi
$ nano /etc/gitweb.conf
# path to git projects (
.git) $projectroot = "/home/roger/z-git-repos"; # directory to use for temp files $git_temp = "/tmp"; # target of the home link on top of all pages #$home_link = $my_uri || "/"; # html text to include at home page $home_text = "indextext.html"; # file with project list; by default, simply scan the projectroot dir. $projects_list = $projectroot; ##$projects_list = "/home/git/projects.list"; # stylesheet to use $stylesheet = "/gitweb/gitweb.css"; # logo to use $logo = "/gitweb/git-logo.png"; # the 'favicon' $favicon = "/gitweb/git-favicon.png";
restart apache2 web server:
Now you should be able to view gitweb listing all GIT projects under /home/roger/z-git-repos/$ sudo /etc/init.d/apache2 restart
http://localhost/gitweb
Your repo can be your shared local directory
or you can have git-daemon running on local and pointing to /home/roger/z-git-repos/ as repo-root
$git daemon --reuseaddr --base-path=/home/roger/z-git-repos --export-all --verbose --enable=receive-pack
Now steps to put a local project on this git-repo:
say you have project which is Not in git (like bare local file system) as ~/projects-try/test-project
with files in it like src/blah
cd test-project test-project $ test-project $ git init Initialized empty Git repository in /home/roger/projects-try/test-project/.git/ test-project $ git add . test-project $ git commit -a -m 'Initial repo creation' test-project $ cd .. ## where ~/z-git-repos/ is repo' server's root dir , like www of apache :) projects-try $ git clone --bare ./test-project ~/z-git-repos/test-project.git Initialized empty Git repository in /home/roger/z-git-repos/test-project.git/ projects-try $ cd ~/z-git-repos/test-project.git test-project.git $ git --bare update-server-info test-project.git $ mv hooks/post-update.sample hooks/post-update test-project.git $ chmod a+x hooks/post-update test-project.git $ touch git-daemon-export-ok test-project.git $ git config core.sharedRepository group test-project.git $ ## then rename local ~/projects-try/test-project as ~/projects-try/test-project-junk then checkout the master, so that we continue the server's repo as master cd ~/projects-try mv test-project test-project-junk git clone git://roger/test-project.git
now you have master's copy from repo's server which is shared by other users
and you work on it as that is the master trunk
now you can trash out the "test-project-junk"
Tuesday, October 26, 2010
GIT and GitWeb Install
Subscribe to:
Posts (Atom)