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?
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 gitosisrepositories/
directory.I cloned my
gitosis-admin.git
repository and added the following then committed:I then went to my home directory and performed the following:
This should successfully push to the server and then I wiped the
test1
directory away and clone it from gitosis:This should also push successfully as well so I then remove the
test1
line from thegitosis.conf
config and commit the change... I then try the following:Unlike the previous two pushes this one fails with the following error message:
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.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.
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.