{{Note|Replace "/path/to/your/repositories" with your path and replace "<your_server>" with your servername or ip (localhost for example). As for the ":~" part in the "git@<your_server>:~" line. It now expects the git repos to bei n your home folder! Also change that accordingly.}}

+

To enable "blame" view (showing the author of each line in a source file), add the following line:

+

$feature{'blame'}{'default'} = [1];

Now the the configuration is done, please restart your webserver.

Now the the configuration is done, please restart your webserver.

Line 52:

Line 61:

/etc/rc.d/lighttpd restart

/etc/rc.d/lighttpd restart

−

=Adding repositories=

+

===Syntax highlighting===

−

To add a repository go to your repository folder. There make your repository like so:

+

+

To enable syntax highlighting with Gitweb, you have to first install the {{Pkg|highlight}} package from <nowiki>[community]</nowiki>:

+

pacman -S highlight

+

+

When highlight has been installed, simply add this line to your {{ic|gitweb.conf}}:

+

{{bc|<nowiki>$feature{'highlight'}{'default'} = [1];</nowiki>}}

+

+

Save the file and highlighting should now be enabled.

+

+

==Adding repositories==

+

To add a repository go to your repository folder, make your repository like so:

mkdir my_repository.git

mkdir my_repository.git

git init --bare my_repository.git/

git init --bare my_repository.git/

Line 68:

Line 87:

I assumed that you want to have this repository as "central" repository storage where you push your commits to so the git-daemon-export-ok and --bare are here to have minimal overhead and to allow the git daemon to be used on it.

I assumed that you want to have this repository as "central" repository storage where you push your commits to so the git-daemon-export-ok and --bare are here to have minimal overhead and to allow the git daemon to be used on it.

−

That is all for making a repository. You can now see it on your http://localhost/gitweb (assuming everything went fine). You don't need to restart apache for new repositories since the gitweb cgi script simply reads your repository folder.

+

That is all for making a repository. You can now see it on your http://localhost/gitweb (assuming everything went fine). You do not need to restart apache for new repositories since the gitweb cgi script simply reads your repository folder.

−

−

=Git daemon=

−

{{Merge|Git}}

−

{{Note|Merge note. This section should belong in [[Git]] and this article should link to that page.}}

This will allow url's like "git clone git://localhost/my_repository.git".

−

−

Edit configuration file for git-dameon /etc/conf.d/git-daemon.conf (GIT_REPO is a place with your git projects), then start git-daemon with root privileges:

−

/etc/rc.d/git-daemon start

−

−

To run the git-daemon every time at boot, just append git-deamon to DAEMONS line in /etc/rc.conf file.

−

−

Clients can now simply use:

−

git clone git://localhost/my_repository.git

−

−

=Git SSH=

−

{{Merge|Git}}

−

{{Note|Merge note. This section should belong in [[Git]] and this article should link to that page.}}

−

You first need to have a public SSH key. For that follow the guide at [[Using SSH Keys]]. To setup SSH itself you need to follow the [[SSH]] guide. I assume you have a public SSH key now and your SSH is working.

−

Open your SSH key in your favorite editor (default public key name is id_rsa.pub and is located in ~/.ssh) and copy it's content (CTRL + C).

−

Now go to your user where you have made your git repository, since we now need to allow that SSH key to login on that user to access the GIT repository.

−

Open this file in your favorite editor (i use nano)

−

nano ~/.ssh/authorized_keys

−

and paste the contents of id_rsa.pub in it. Be sure it is all on one line! That is important! It should look somewhat like this:

−

{{Warning|Do not copy the line below! It is an example! It will not work if you use that line!}}

Now you can checkout your git repo this way (change where needed. Here it's using the git username and localhost):

−

git clone git@localhost:my_repository.git

−

You should now get an SSH yes/no question. Type yes followed by enter. Then you should have your repository checked out. Since this is with SSH you also do have commit rights now. For that look at [[Git]] and [[Super Quick Git Guide]].

−

−

=Git HTTP=

−

{{Merge|Git}}

−

{{Note|Merge note. This section should belong in [[Git]] and this article should link to that page.}}

−

This section will explain how to do a git clone over http. For now this is only reading (cloning), not writing (pushing).

−

First you need to make your Git repositories accessable over your web server. So lets assume your git repositories are outside of the default apache documentroot. You can skip this part if they are within your apache documentroot.

−

−

==Read access==

−

Lets assume your git repositories are in /usr/git. You need to add an Alias to apache and a Directory section to make it accessable.

−

Append the following to your /etc/httpd/conf/httpd/conf (change where your paths differ. the /git-repos is how it will be accessible in your browser like : http://localhost/git-repos):

−

Alias /git-repos /usr/git

−

<Directory "/usr/git">

−

Options Indexes FollowSymLinks MultiViews ExecCGI

−

AllowOverride All

−

Order allow,deny

−

Allow from all

−

</Directory>

−

−

Save it and restart apache:

−

/etc/rc.d/httpd restart

−

−

Now you should see your git repositories at http://localhost/git-repos or whatever you choose as "git-repos" name in the above alias name.

−

Next we need to do a "git update-server-info" in your local git repository. Note that you must do that where the actual git repo is created, not where you cloned it. So run this in your git repository:

−

git update-server-info

−

−

That command is needed to be able to clone over http so it's better to make a post-update hook for it so this command always runs when you do a push to the repository. To get that done go to your git repository in the "hooks" folder and run this:

−

mv post-update.sample post-update

−

−

We can do this because the default post-update.sample hook is doing exactly what we want (running git update-server-info after a commit).

−

−

Last we need to make a change to gitweb.conf to show the url for http cloning. Open gitweb.conf in your favorite editor (i use nano):

−

nano /etc/conf.d/gitweb.conf

−

−

Find the line (the dots resamble some content in that line:

−

our @git_base_url_list = qw(...)

−

Add something like this (again depends on what you did with the Alias in Apache):

This howto was mainly based on the awesome howto from howtoforge: http://www.howtoforge.com/how-to-install-a-public-git-repository-on-a-debian-server I only picked the parts that are needed to get it working and left the additional things out.

This howto was mainly based on the awesome howto from howtoforge: http://www.howtoforge.com/how-to-install-a-public-git-repository-on-a-debian-server I only picked the parts that are needed to get it working and left the additional things out.

Revision as of 20:07, 3 October 2012

Gitweb is the default web interface provided with git itself and is the basis for other git scripts like cgit, gitosis and others.

I assumed that you want to have this repository as "central" repository storage where you push your commits to so the git-daemon-export-ok and --bare are here to have minimal overhead and to allow the git daemon to be used on it.

That is all for making a repository. You can now see it on your http://localhost/gitweb (assuming everything went fine). You do not need to restart apache for new repositories since the gitweb cgi script simply reads your repository folder.