开发者

Git bare - what to backup?

开发者 https://www.devze.com 2023-01-31 15:43 出处:网络
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'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:

  1. We need to know what to backup.
  2. My boss wants to know where the source code has gone.
  3. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号