10

I'm using Gitosis to administer some Git repositories on a remote server. Since I'm at the beginning with it, I make a lot of mistakes. That's why right now I need to delete a Git repository that I created with Gitosis. Is this possible using Gitosis or do I have to log into that machine and do it from there?

3 Answers 3

13

Gitosis by itself does not have a remove function because of the way it is managed through git commits. If you remove the repository from the gitosis.conf and commit the change then the repository is no longer accessible. You can re-enable it later or you can eventually log into the server and remove the file from the gitosis repositories/ directory.

I cloned my gitosis-admin.git repository and added the following then committed:

[group gitosis-admin]
writable = gitosis-admin test1
members = jbouse

I then went to my home directory and performed the following:

mkdir test1
cd test1
git init
git remote add origin git@server:test1.git
echo "Testing" > test.txt
git add test.txt
git commit -m 'First commit'
git push origin master:refs/heads/master

This should successfully push to the server and then I wiped the test1 directory away and clone it from gitosis:

git clone git@server:test1.git
cd test1
echo "Test worked" > test.txt
git add test.txt
git commit -m 'Second commit'
git push

This should also push successfully as well so I then remove the test1 line from the gitosis.conf config and commit the change... I then try the following:

cd test1
echo "Final test" > test.txt
git add test.txt
git commit -m 'Third commit'
git push

Unlike the previous two pushes this one fails with the following error message:

ERROR:gitosis.serve.main:Repository read access denied
fatal: The remote end hung up unexpectedly

The error is because gitosis does not have anything configured for the test1 repository now. If you attempt to clone the repository again you will receive the same error.

1
  • 5
    After that you can remove physical repositories on the server. Login, go to git's home directory, go to "repositories" from there, and you have directories for all your repositories. Remove ones you disabled in gitosis.conf. Nov 17, 2009 at 5:55
2

You have to log into the machine and remove the repository there and then you have also to remove the repository from the gitosis configuration file.

0

Jeremy Bouse's answer is a good strategy, but doesn't actually delete the repo. Sometimes you might specifically need to delete the repo because of disk space, security, etc.

So I'd recomend ultrafedde's method, with the addition that you will probably need to su to remove the repo that the "git" user you setup owns.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .