[Update1] Gitosis under Debian Wheezy

The last week, I managed to switch over to gitolite. It works like charm without any evil hack, does what it should do, but I don’t think the transfer is as easy as stated. The easiest way was to

  1. move all git-repos /somewhere/
  2. completely uninstall gitosis
  3. install and configure gitolite as stated on their homepage using glsetup
  4. move the repos back into gitolite’s “$GIT”-directory

Some months ago, a friend of mine showed me gitosis, a collection of scripts that provide an easy-to-configure git-server. By that time, there was an almost ready-to-use-.deb in debian/squeeze. But with migration to Wheezy, gitosis broke.

The exact traceback:

Traceback (most recent call last):
  File "/usr/bin/gitosis-serve", line 9, in <module>
    load_entry_point('gitosis==0.2', 'console_scripts', 'gitosis-serve')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 337, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 330, in get_distribution
    if isinstance(dist,Requirement): dist = get_provider(dist)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 209, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 686, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 584, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: gitosis==0.2

Several homepages proposed symlinking back from python2.x to python2.5, which SHOULD work. But would you like to switch to a deprecated version of python? I wouldn’t. (Furthermore, python2.5 isn’t in the wheezy-repos, either)

So here’s the REAL problem with gitosis: During the upgrade to Wheezy, some paths within the system changed, especially those for including. The “*.egg”-file gitosis provides (and gitosis-serve requires, loaded through pkg_resources.load_entry_point !) lies within ‘/usr/share/pyshared’, which is missing in python2.7’s ‘path’-variable (just try: call ‘sys.path’ in interactive python-session after having imported the ‘sys’-package)

For me, gitosis worked again after changing the file ‘/usr/bin/gitosis-serve’ in the following way:

--- /usr/bin/gitosis-serve-old  2013-08-12 11:27:15.126399705 +0200
+++ /usr/bin/gitosis-serve      2013-08-12 11:14:40.237563062 +0200
@@ -2,6 +2,7 @@
 # EASY-INSTALL-ENTRY-SCRIPT: 'gitosis==0.2','console_scripts','gitosis-serve'
 __requires__ = 'gitosis==0.2'
 import sys
+sys.path.append('/usr/share/pyshared/')
 from pkg_resources import load_entry_point
 
 if __name__ == '__main__':
Written by pheerai on 12/08/2013 Categories: Free/Open Source Software, International corner Tags: , , , ,
4 Comments on [Update1] Gitosis under Debian Wheezy

4 Comments

  • asdil12 says:

    Did you have a look at http://gitlab.org

    • pheerai says:

      IMHO, GitLab is way to bloated (RoR, seriously?). I searched for a simple tool, which only needed a user “git”, a running ssh server and some textfiles for config. In fact, with Gitosis you configure your GitServer via Git (this is somehow strange, but I like that weird way).

      One project I stumbled upon was gitolite, which even is in the current debian-repos, but I wasn’t in the mood to transfer my whole git system directly. But I regard this as a workaround ’til I do switch to gitolite.

      • asdil12 says:

        I only recently found out, that I can use my local ssh key any host by accessing it using ”ssh -A”.
        After that, a non-http-capable git-server becomes an alternative.

        • pheerai says:

          Still, I don’t understand why you’re all about that http-capable git server…
          If you use gito${sis,lite}, it’s all about SSH and git itself. That’s exactly what makes it that elegant.

          Let’s say you want to push a new repository that’s not on your server yet, but that exists locally. You (locally) edit the config-file, add lines with the name of the repo and which user should be able to access it read- or writeable, and commit and push these changes to your server, afterwards you just push your new project as if the repo already exists, and gito${sis,lite} will create all the necessary files.

          I can’t imagine any way of easier configuration.

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha * * Time limit is exhausted. Please reload the CAPTCHA.