Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any concurrency issues in backing up git?

Tags:

git

I've seen lots of people say you can backup git repositories by just copying them, but what happens if you are copying the repository at the same time that someone is pushing some changes up to it?

like image 261
user180750 Avatar asked Jan 24 '23 04:01

user180750


2 Answers

Basically what will happen is that you will get the complete repo at the time of copy. If there is a partial transaction hanging around from a push at time of copy it will be cleaned up as a failed transaction, just like you had lost a network connection while pushing to a remote repository.

like image 57
stonemetal Avatar answered Jan 27 '23 06:01

stonemetal


If you're worried about concurrency, it should be quite safe to instead use

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

As every git repository has a complete copy of everything, it's an effective backup which is guaranteed (at least as much as git itself is!) to be concurrency-safe

like image 40
Steven Schlansker Avatar answered Jan 27 '23 06:01

Steven Schlansker