Convention for storing bare Git repositories in home directory?

434 views Asked by At

In my home directories, I usually store source code (whether as a decompressed tar ball or a Git/Subversion working copy) beneath $HOME/src slightly inspired by the FHS. I want to keep bare Git repositories separate from those.

Is there any convention where to store bare Git repositories in home directories?

2

There are 2 answers

0
wjl On BEST ANSWER

When I don't have control over a system and can only access it as a user, I have tried in some cases to treat my home directory a little like it's another FHS / or /usr directory.

So I have /home/me/var/git/whatever.git (bare repository) and /home/me/src/whatever (working repository), along with /home/me/bin, /home/me/lib, and /home/me/share/, etc for single-user locally installed software.

This has worked okay for me, but it does require for consistency that you are careful about organizing what goes where, and not letting random programs writing garbage whereever they want.

0
Alexander Bauer On

There is no standing convention of which I'm aware. However, I have found that storing bare repositories at /var/git/ works very well. You can also create a system user (useradd git -r -d /var/git/) to ease repository access. This would allow a syntax for accessing repositories like git@localhost:repository.git.

This keeps the bare repositories, which you don't need to access frequently, under normal circumstances, separate from your working copies. It also allows you simple remote access, if you were so inclined, via ssh to the git user.

Edit: I just noticed that you specified using the home directory. If it is absolutely necessary that you use your home directory, I would recommend using ~/.git_bare/ or ~/.GIT_BARE/.