Git bare - what to backup?
I'm sorry if this is covered elsewhere, but I can't find the answer.
I have a bare repo, called bare.git which is the repository from which are cloned the dev repos. It all works well.
I want to know where bare.git gets the source files from. Are they stored as binary files inside the bare.git file structure? I can move bare.git to another location and still clone repos out of it, so the source must, in some way, be portable. Or is it storing absolute network references to the files?
There are three main reasons I want o know this information:
- We need to know what to backup.
- My boss wants to know where the source code has gone.
- We need a current composit开发者_运维技巧e version for testing.
Your source files are stored as a part of the index inside of bare.git file structure, which is same as you have in .git directory in any of your clones.
So, it's best to backup full bare.git.
You may get current version for testing by cloning your bare repo.
Why would you not backup all of the repo?
See The Git Object Model and How Git Stores Objects.
Backup the whole bare.git folder not to miss out, you could always clone it later.
When you wish to test source code, you need to clone it. The article Using Git to manage a web site shows you one way to deal with the issue by checking out the whole repo after each push to bare.git, automatically of course. This code is what you should test (unless you'd like to do that before pushing to bare.git, in pre-commit or pre-receive.
精彩评论