Gitosis Server tutorial for installing git under the Debian system

Source: Internet
Author: User
Tags commit svn

I've been using Google code for some time, and I've probably learned how to use SVN (I don't really know, because I used the eclipse's SVN plugin and didn't manually use the SVN command). Want to at home Godson also get a version management software, so that you can control the written version of the software, but also to achieve the backup of these programs.

I used to build a SVN server on my own computer, so I wanted to try to build a git server this time. Git is a distributed version control software, so there is no strong server concept in itself. So we chose the Gitosis software.

Installation of this software is very convenient, directly with the apt-get on it, for a long time did not refresh the source of software, resulting in the first installation did not succeed, a fresh refresh will be good. After installation, configure Gitosis as instructed by http://en.gentoo-wiki.com/wiki/Gitosis this wiki. One thing to note, however, is that the gitosis created by the Debian installation are gitosis, so the remote path account names described on the wiki are changed to gitosis.

After generating a pair of key pairs locally with Ssh-keygen, the public key is uploaded to the godson, and then the public key is initialized to the version library so that my computer is the owner of this version of the library. After initialization, you can use the Gitosis account remote clone a gitosis-admin.git version of the library, which has the account and code library settings, modified, first commit to the local, and then push to the remote version of the library.

Before installing gitosis, APT advised me to install Git-daemon-run and gitweb two packages, then try it. The previous package seems to be managed with the Runit program, it is not clear how to control the open and close (in the/ETC/INIT.D folder without service script), modify the/etc/sv/git-daemon/run file, the Git-daemon start parameters to get rid of, Where the Base-path changed to the version library path, I am here to/srv/gitosis/repositories (gitosis account home directory is in/srv/gitosis), and finally add –export-all to expose all versions of the library.

Then install Gitweb, installation is also very convenient, configuration up trouble point. Because it will not be able to get Apache virtual host, so directly in the original default host configuration. Copy the gitweb.cgi of the Gitweb installation in/usr/lib/cgi-bin to the Cgi-bin path that was originally configured (I am here/srv/sgi-bin) and put/usr/share/ The pictures and CSS files under Gitweb are copied to the root directory of the Apache default host (I copied them to the/srv/www/git folder). Then configure/etc/gitweb.conf, where $projectroot is changed to the root path of the repository (I'm/srv/gitosis/repositories here), and the path to all the pictures and CSS files is preceded by a "/git" (because I put them in the Git directory under the root of the default host). Finally, to modify the Apache configuration, the default host profile for Debian is/etc/apache2/sites-enabled/000-default, which is added under the Virtual Host project:
Setenv gitweb_config/etc/gitweb.conf

This way Apache will read the Gitweb configuration file and set the appropriate environment variables.

The code is as follows Copy Code
<directory "/srv/www/cgi-bin/gitweb" >
Options FollowSymLinks execcgi
Allow from all
AllowOverride All
Order Allow,deny

<files gitweb.cgi>
SetHandler Cgi-script
</Files>
Rewriteengine on
Rewritecond%{request_filename}!-f
Rewritecond%{request_filename}!-d
Rewriterule ^.*/gitweb.cgi/$0 [l,pt]
</Directory>


This paragraph from the Internet to copy the settings, should be rewrite the URL with the bar.

The code is as follows Copy Code
<directory "/srv/gitosis/repositories" >
Allow from all
</Directory>

This should be set to access the version Library root folder, but this setting does not seem to work.

Restart Apache, Access xxx/cig-bin/gitweb.cgi, but the 403 error is displayed and no access is granted. It is not clear why this is the case, the entire version library root folder access permissions to 755 can be displayed.

Finally, look at your own local initialization git version library, and then put it in a remote version library. Initialization is successful and can be seen in the Gitweb page. But after the modification commit, and then push, the error project description file hasn ' t been set. This does not know how to solve, online search, said is to modify both local and Remote description file (. git/description), and then indeed can be submitted. Try to get here first, then continue ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.