As part of our Git server configuration, we’re using Gitosis manage multiple repositories with different authorization requirements using a single SSH account.
I’m assuming you’ve read my previous post on Setting up a Git server with Windows Server 2008 and are ready to follow along as the steps assume you’ve already installed Cygwin with Git, OpenSSH and Python.
The blog post by Sandesh Singh on setting up Gitosis with Windows Vista was an amazing resource and without it, I would still be trying to get Gitosis working.
Installing Python Setuptools
- Download the Python Setuptools egg.
- Open a Cygwin bash prompt and navigate to the directory containing your download.
- Execute
sh setuptools-0.6c9-py2.5.egg
- You should see
Processing setuptools-0.6c9-py2.5.egg Copying setuptools-0.6c9-py2.5.egg to /usr/lib/python2.5/site-packages Adding setuptools 0.6c9 to easy-install.pth file Installing easy_install script to /usr/bin Installing easy_install-2.5 script to /usr/bin Installed /usr/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg Processing dependencies for setuptools==0.6c9 Finished processing dependencies for setuptools==0.6c9
- Execute
chmod +r /usr/lib/python2.5/ -R
Installing Gitosis
- Download or clone the Gitosis repository
- Open a Cygwin bash prompt and navigate to the directory containing Gitosis.
-
Execute
python setup.py install
- Copy the public key of the user you wish to administer the Gitosis server to /tmp directory.
- Log out of the Administrator account and login as the git account.
- Open a Cygwin bash prompt and execute
gitosis-init < /tmp/id_rsa.pub
-
You should see
Initialized empty Git repository in /home/git/repositories/gitosis-admin.git/ Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/
- Execute
chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
Gitosis is now setup and we're ready to clone the gitosis-admin repository to create and administer Git repositories on our server.
Hi, and thank you very much for your posts on setting up a local Gir repository. I’m not used at all to use these command lines and your explanations are very helpful!
For the newbies like me, I would like to add an information I did not find immediatly:
“Copy the public key of the user you wish to administer the Gitosis server to /tmp directory.”
-> The original file can be found in “/home/xxxx/.ssh/id_rsa.pub” and has to be copied in “/tmp” (where xxxx is the user name : git for example)
Thanks,
Pierre
Shannon,
I get this error when I tried to clone the gitosis-admin repository on my local machine -
someone@someplace /c/downloads
$ git clone git@warthog.someplace.edu:gitosis-admin.git
Initialized empty Git repository in c:/downloads/gitosis-admin/.git/
git@warthog.someplace.edu‘s password:
fatal: ‘gitosis-admin.git’: unable to chdir or not a git archive
fatal: The remote end hung up unexpectedly
Is the git user that I create on the client or server machine? I suspect I follow the gitosis blog tutorials on the server, but maybe run the ssh part on the local machine that is my client (git user) – and copy the key generated here to the server /tmp folder? to get the key auth pair to work? Does any of this sound familiar? Every part of this tutorial works great except for trying to clone the gitosis admin repo. Thanks,
Hi Pierre,
Thanks for the additional information.
Robert,
The git user you create is on the server.
From the error, it looks like you are unable to authenticate to your git server.
Did you copy your client SSH key to the server’s /tmp folder?
Thanks for the guide Shannon!
Robert,
I got the same “unable to chdir or not a git archive” problem. I solved it by using the path to the repositories folder.
example:
git clone git@domain.com:/home/git/repositories/gitosis-admin.git
Something interesting I noticed (and struggled with for a while) was that the gitosis-init command (gitosis-init < /tmp/id_rsa.pub) fails if the username in the key (id_rsa.pub) has numerics in it, weird. It complains about invalid characters in the username. My particular problem was that the key I created using ssh-keygen created the key with a user git@ but had numerics in it.
Ok the comment dropped off some of the text, that last piece should read:
…I created using ssh-keygen create the key with a user git@*servername* but *servername* had numerics in it.
I get this error when I tried to clone the gitosis-admin repository on my local machine
$ git clone git@TUANHA:gitosis-admin.git
Initialized empty Git repository in d:/temp/gitosis-admin/.git/
git@TUANHA’s password:
fatal: ‘gitosis-admin.git’: fatal: ‘gitosis-admin.git’ does not appear to be a git repository
fatal: The remote end hung up unexpectedly
but command
$ git clone git@TUANHA:/home/git/repositories/gitosis-admin.git run well
How to fix it.
Thanks you very much.
@ TuanHA,
Make sure that you arenot prompted for password, if you are prompted for password, then your public keys are not in place. If you need further help contact me: myself | linuxtechie.net
I’m stuck there.
$ gitosis-init < id_rsa.pub
2 [main] python 66492 C:\cygwin\bin\python.exe: *** fatal error – unable t
o remap \\?\C:\cygwin\lib\python2.6\lib-dynload\time.dll to same address as pare
nt: 0×360000 != 0×380000
2 [main] python 30908 fork: child 66492 – died waiting for dll loading, er
rno 11
Traceback (most recent call last):
File "/usr/bin/gitosis-init", line 8, in
load_entry_point(‘gitosis==0.2′, ‘console_scripts’, ‘gitosis-init’)()
File “/usr/lib/python2.6/site-packages/gitosis-0.2-py2.6.egg/gitosis/app.py”,
line 24, in run
return app.main()
File “/usr/lib/python2.6/site-packages/gitosis-0.2-py2.6.egg/gitosis/app.py”,
line 38, in main
self.handle_args(parser, cfg, options, args)
File “/usr/lib/python2.6/site-packages/gitosis-0.2-py2.6.egg/gitosis/init.py”,
line 136, in handle_args
user=user,
File “/usr/lib/python2.6/site-packages/gitosis-0.2-py2.6.egg/gitosis/init.py”,
line 75, in init_admin_repository
template=resource_filename(‘gitosis.templates’, ‘admin’)
File “/usr/lib/python2.6/site-packages/gitosis-0.2-py2.6.egg/gitosis/repositor
y.py”, line 51, in init
close_fds=True,
File “/usr/lib/python2.6/subprocess.py”, line 480, in call
return Popen(*popenargs, **kwargs).wait()
File “/usr/lib/python2.6/subprocess.py”, line 633, in __init__
errread, errwrite)
File “/usr/lib/python2.6/subprocess.py”, line 1049, in _execute_child
self.pid = os.fork()
OSError: [Errno 11] Resource temporarily unavailable
Sebastien,
I had the same problem but found the solution here: http://yosanai.com/cygwin-unable-remap-dll-same-address-parent
I had to stop the SSHD service, close all cygwin windows, run the c:\cygwin\bin\ash.exe shell and then execute /bin/rebaseall