gitosis + git error: fatal: '/home/git/repositories/idea-generator.git' does not appear to be a git repository
I have tried to follow the instructions on how to use gitosis to manage my git projects. Other than one slight issue, I have installed gitosis successfully.
The problem arises when I try to create my first git project (after having set-up and configured the project through gitosis). I get the following error when I push to the remote git repository:
fatal: '/home/git/repositories/idea-generator.git' does not appear to be a git repository fatal: The remote end hung up unexpectedly
These is the sequence of commands that I am running to install gitosis and push my first project from beginning-to-end. I am running these commands against the same server. For now my development machine is the central git repo but at some point will become a stand-alone server dedicated to housing git and some other projects.
OS: Ubuntu 10.04 git: 1.7.0.4 python: 2.6.5
cd /home/rdn/projects git clone git://eagain.net/gitosis.git cd gitosis sudo python setup.py install sudo adduser --system --shell /bin/sh --gecos 'git version control' --group --disabled-password --home /home/git git sudo -H -u git gitosis-init < /home/rdn/.ssh/id_rsa.pub sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update cd .. # At this point I can't use the instructed 'git clone git@Frankenstein:gitosis-admin.git' as it complains that "fatal: 'gitosis-admin.git' does not appear to be a git repository" git clone git@Frankenstein:/home/git/repositories/gitosis-admin.git cd gitosis-admin gedit gitosis.conf # added following entries to ../gitosis-admin/gitosis.conf # [gitosis] # loglevel = DEBUG # repositories = /home/git/repositories # # [group gitosis-admin] # writable = gitosis-admin # members = rdn@Frankenstein # # [group idea-generator] # writable = idea-generator # members = rdn@Frankenstein git commit -a -m "created first repository" git push cd .. rails new idea-generator cd idea-generator git init git remote add main_project git@Frankenstein:/home/git/repositories/idea-generator.git git add . git commit -a -m "initial project creation" git push main_project master:refs/heads/master
Update
The only way I was able to 'fix' this was to log into the remote server and create the remote repository as follows:
As the git user in the gitosis repository location create a remote bare project:
git:~ cd /home/g开发者_JAVA技巧it/repositories git:~ mkdir idea-generator.git git:~ cd myapp.git git:~ git --bare init
As the commiter user (in my case rdn), commit and push the newly-created project.
rdn:~ cd /home/rdn/projects/idea-generator rdn:~ git init rdn:~ git remote add main_project git@Frankenstein:/home/git/repositories/idea-generator.git rdn:~ git add . rdn:~ git commit -a -m "initial project creation" rdn:~ git push main_project master:refs/heads/master
All tutorials and documentation that I have read left this important step out. Perhaps on other distributions this step is not necessary, but in my case I found it necessary. Hopefully someone will be able to answer this initial question and determine what steps need to change in order to make the original tutorials work under Ubuntu 10.04.
If you're able to fetch/push repos with full paths (/home/git/repositories/idea-generator.git), then you're bypassing gitosis completely, including any access checks it may impose. You may as well not be using gitosis, for all the good it is doing you.
That is also the reason that a push did not auto-create the repo for you -- gitosis was bypassed, so no auto-create.
Proper use of gitosis means your URLs will look like git@Frankenstein:gitosis-admin.git (since you said you managed to clone this successfully).
I just ran the tutorial successfully. My server is 'valkyrie' running ubuntu 10.4 and my client, 'wraith' is OS X 10.6.1. Make sure you use your client rsa/dsa key and not your server's. Here's my example:
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIw...== mwilliamson@wraith" | sudo -H -u git gitosis-init
精彩评论