On git, gitosis, and python issues on Windows Vista

Some browsing, debugging, and IRC chats later, I have managed to set up a git repository on Windows Vista using cygwin, with a few unexpected hiccups. I will try to repeat the process on a virgin setup to come up with a more authoritative flowchart of how to go about things. For now, I’ll just list down the issues I faced.

I used gitosis to host git repositories over ssh. It’s pretty elegant, really. Administering gitosis is limited to managing a configuration file and user keys, which itself themselves are in a gitosis hosted git repository. Neat.

These two articles

cover everything you need to do to host git repos. The first link should be straightforward. However, since the second link is for linux users, there are a few deviations for windows. Try to follow the link, if you face difficulties, refer to the tips below.

Installing gitosis

Log in to an administrator account. Do a

cd ~/src
git clone git://eagain.net/gitosis.git
cd gitosis
python setup.py install

If the last command fails thusly

Traceback (most recent call last):
File "setup.py", line 2, in ?
from setuptools import setup, find_packages
ImportError: No module named setuptools

you may need setuptools from here. Scroll to the bottom, download an egg, and do

sh setuptools-0.6c9-py2.5.egg

Repeat the last step. After you have installed gitosis successfully, run the following command

chmod +r /usr/lib/python2.5/ -R

This was the first wtf. The downloaded egg we just installed gets installed with administrator ACLs, the above command ensures that everyone has access to the downloaded eggs.

Setting up gitosis

You need to add the git repository user `git’ the windows way (the adduser command in the second link will not work). Once you’ve done that, make sure you’ve run the following commands

# in the new 'git' user's account
ssh-user-config

# from the admin account
# (domain users need to add '-d domain_name' to the mk* commands)
mkpasswd.exe -l > /etc/passwd
mkgroup.exe -l > /etc/group

Also, the command

sudo -H -u git gitosis-init < /tmp/id_rsa.pub

will need to be run as

# git user's account
gitosis-init < /tmp/id_rsa.pub

Of course, this assumes that you’ve copied your key to the /tmp folder.

The rest of the write-up should be fine, except for one thing. When you try to `git commit’ you repo configuration, you may see an error like :

Counting objects: 5, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 307 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To git@localhost:gitosis-admin.git
989f371..0616ebb master -> master
: invalid optione: line 2: set: -
set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]

Second wtf. Damn those pesky windows newlines. Do a

# `git' user's account
dos2unix ~/repositories/gitosis-admin.git/hooks/post-update

and you should be good to go.

This should do it. If you still run into problems, let me know. If you find solutions to them, post them up so that I may link to you. And when you do have a git repository up, give me the url to fork from :)

Edit: fixed grammar

This entry was posted in git, gitosis, python, vista, windows. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

3 Comments

  1. Posted March 9, 2010 at 4:48 pm | Permalink

    Just wanted to thank you for that one line:
    dos2unix ~/repositories/gitosis-admin.git/hooks/post-update

    That was totally my last wtf to get over and get gitosis working – so thank you!

  2. Adam
    Posted November 4, 2009 at 3:36 pm | Permalink

    I too have the ‘request for git user password’ error that I have verified with each and every flavor (server, desktop, alt) of Ubuntu 9.10. It is the stupidest error I have ever gotten in my 20+ years of computing because it is *IMPOSSIBLE* that other people are not having this problem if I can reproduce it repeatedly on completely fresh installations. And yet, I can’t find a single damn site that explains WHY the heck it fails. Lame. All I find are random comments where some noob forgot the permissions. I’m sure I can figure out the issue, but that’s not what I sat down in front of the computer to do. I wanted to set up a Git repo, but it seems that it is a glorified file transfer program that simply doesn’t work out of the box.

  3. Rory
    Posted October 3, 2009 at 12:18 pm | Permalink

    I am trying to setup Git and Gitosis on an Ubuntu server and a variety of clients, and initially a single Windows (Vista) client.

    The setup of git and gitosis on Ubuntu seems to be fine, as well as msysgit, PuTtY, and TortoiseGit (for whatever that’s worth) on my Windows Vista client, but when I try to do the following command via ‘PuTTY’ or ‘Git bash’ from my Vista client per instructions:

    git clone git@MY SERVER:gitosis-admin.git

    the server keeps asking me for the ‘git’ user password, even though I set up the user with ‘password disabled’ per instructions. I am stuck here and can’t move forward.

    How can I resolve this problem, or can you point me to specific instructions for setup of Windows clients with an Ubuntu/Linux server using Gitosis that includes addressing this? I can’t believe I’m the only one who has run into this, but can’t locate the answer despite many hours of searching. Although I’m confident git is a great tool, I am going to have to abandon it and go for an inferior tool with better docs and support if I can’t get through this, although I would hate to do so.

    thanks a lot,

    Rory
    r0ryr@yahoo.com
    (please note the second char is a ‘zero’, not a letter:)

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Previously …

  • Categories

  • Meta