Are there any problems with concurrency while backing up git?

I have seen many people say that you can back up git repositories just by copying them, but what happens if you copy the repository at the same time that someone is pushing some changes to it?

+4
git
Sep 28 '09 at 21:45
source share
4 answers

Basically, what happens is you get a complete repo during copying. If a partial transaction hangs around from being clicked during copying, it will be cleared as a failed transaction, just as you lost a network connection by clicking on the remote repository.

+5
Sep 28 '09 at 21:57
source share
β€” -

If you are worried about concurrency, you should use it safely instead

git clone / my / repository / location / my / backup / location

Since every git repository has a full copy of everything, this is an effective backup that is guaranteed (at least like git)! concurrency -safe

+3
Sep 28 '09 at 21:49
source share

No, git central data storage is atomic, by design.

You cannot lose commits in this way, just abstracts.

If you lose links, they are easy to repair.

+2
Sep 28 '09 at 21:53
source share

A problem may arise if the copying takes a lot of time, and if you somehow copy the database of objects first, then refs, and someone updates ref (therefore rsync:// transport is out of date). I think that if you copy the refs first and then the object database (and the rest), you should not have any problems.

0
Sep 29 '09 at 0:09
source share



All Articles