开发者

Cygwin/Git/Gitosis unable to push new repository

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 开发者_C百科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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜