Git naked - what to backup?

Sorry if this is described elsewhere, but I can not find the answer.

I have a bare repo called bare.git which is the repository from which dev repositories are cloned. Everything works well.

I want to know where bare.git gets the source files. Will they be saved as binary files inside the bare.git file structure? I can move bare.git to another place and still clone the repositions, so the source must be somehow portable. Or does it keep absolute network links to files?

There are three main reasons why I want to know this information:

  • We need to know what to do with backups.
  • My boss wants to know where the source code went.
  • We need the current composite version for testing.
+8
git git-bare backup
source share
3 answers

The source files are stored as part of the index inside the bare.git file structure, which is the same as the .git directory in any of your clones.

So, it is best to back up the bare.git file.

You can get the current version for testing by cloning your bare repo.

+6
source share

Why don't you back up your entire repo?

See Git Object Model and How Git Saves Objects .

+5
source share

Do not miss the backup of the entire bare.git folder, you can always clone it later.

If you want to test the source code, you need to clone it. The article Using Git to manage a website shows you one way to solve the problem by checking the entire repo after each click on a bare .git, automatically, of course. This code is what you should check (if you do not want to do this before clicking on the guest., In pre-commit or pre-receive.

+1
source share

Source: https://habr.com/ru/post/650382/


All Articles