Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  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 composite version for testing.
like image 223
Leo Avatar asked Dec 22 '10 15:12

Leo


People also ask

How do I backup a git bare repository?

The correct answer is to do a: git clone --mirror [email protected]/your-repo. git This will copy your entire repository, notes, branches, tracking, etc.

What should I not store in git?

You shouldn't store credentials like usernames, passwords, API keys and API secrets. If someone else steals your credentials, they can do nasty things with it.

What does -- Bare do in git?

Git bare clone Just use the –bare switch with the git clone command and you will have a Git repository without a working tree.

What is git backup?

A git repository can be safely copied to an other directory, or put in an archive file. This is a very basic way of keeping a backup of your repo. cp -r myrepo backup_copy tar -czf backup_copy.tgz myrepo. But such a frozen copy can not be updated.


1 Answers

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.

like image 61
alno Avatar answered Oct 03 '22 04:10

alno