views:

403

answers:

3

I've recently set up cygwin, git, and gitosis on my Windows Server 2003 box and am having troubles. I've followed just about every tutorial I can find to the letter, and have confirmed that my git account's authorized_keys table is getting updated when I push the gitosis-admin repository. I seem to be stuck, however, when it comes to creating a new repository.

I've seen many tutorials that recommend the following code (obviously the repo name changes), tried in both git bash and windows command line:

mkdir free_monkey
cd free_monkey
git init
touch README
git add .
git commit -m "Added blank readme"
git remote add origin git@my_server:free_monkey.git
git push origin master

When I execute the last line (no matter exactly what I send), it says "The remote end hung up unexpectedly": $ git push -v origin master:refs/heads/master Pushing to git@my_server:free_monkey.git fatal: The remote end hung up unexpectedly

My gitosis.conf file looks like the following:

[gitosis]
loglevel = DEBUG

[group gitosis-admin]
writable = gitosis-admin free_monkey.git free_monkey
members = git@my_server @all

Please let me know if I'm missing any information you need to help me debug this. Thank you!

One other thing that concerns me:

$ ssh git@my_server git 
DEBUG:gitosis.serve.main:Got command 'git' 
ERROR:gitosis.serve.main:Unknown command denied

Is that maybe the problem? If so, how do I fix that?

A: 

You probably made a typo on the first time or something. Try removing the origin and re-adding it:

git rm origin
git remote add origin git@my_server:free_monkey.git

Then try pushing again. It's worth a try.

Jorge Israel Peña
Unfortunately, no, I've been trying that. I'm still getting "fatal: The remote end hung up unexpectedly"... I've also tried different users before the @, and they aren't working either. Thanks for the quick suggestion.
mattdekrey
A: 

OK, so, it seems that the "Unknown command denied" error was a red herring. Gitosis only allows for the commands that actually get sent across during a git push/pull process for security reasons, so "git" was not a known command.

I continued receiving the same error, but stumbled-upon a reference to the authorized_keys file in another forum - having duplicate keys ruins the authorized_keys file completely. Sure enough, that was my problem. Hope this helps someone out there.

To really diagnose this, follow these steps:

  1. cat your authorized_keys files for the user you're using to access your git repositories (mine was git@my_server, so I looked in /home/git/.ssh/authorized_keys). Make sure you have each public key only once.
  2. I ran into a second problem, which was that I was trying to use multiple ppk's with TortoiseGit and Pageant. Pageant seems to ignore TortoiseGit's request to change keys; right click on Pageant in your taskbar (the computer wearing a hat) and View Keys, then remove all keys that don't match the public key you want to use (could be all of them).

I now have gitosis running on my server available over SSH, accessible via TortoiseGit.

mattdekrey
I've since switched away from using Gitosis to a custom-made solution that uses different usernames and effectively creates a git-hub like situation. I'm interested in sharing the code, but wrote it in C# (I have a good portion in Python, but am simply not very experienced in the language) and would like to get it in a reusable state for others. If anyone's interested, I'll post it up on github to share.
mattdekrey
A: 

I have the same problem. Can you pls decrible more details how you solved this, Matt?

answer