备份现场git的官方方式

我无法find关于如何备份“实时”git存储库的官方指南。

谷歌的第一个结果,当你search这样的事情是:

https://joeyh.name/blog/entry/difficulties_in_backing_up_live_git_repositories/

即使KDE的浮子也在使用导致灾难的方法:

http://jefferai.org/2013/03/29/distillation/

我可以阅读stackoverflow,serverfault,博客的答案…但在我看来有很多困惑。 而这个魔鬼是在细节:我对“KDE事件”的理解是,他们应该在git clone后运行git fsck ,因为git clone不检查错误(但是,在git手册中也没有…)

那么:备份一个活的git仓库的官方方式是什么? 手册中有关备份的内容?

git包在这里很有帮助。 我已经使用了一段时间了:

 base_dir=/home/git for gitrepo in `ls -d *.git` do echo '**********[' ${gitrepo} ']***********' repo_name=${gitrepo%.git} echo cd ${base_dir}/${gitrepo} cd ${base_dir}/${gitrepo} backup_cmd="git bundle create /opt/git-backups/${repo_name}.bundle master" verify_command="git bundle verify /opt/git-backups/${repo_name}.bundle master" backup_cmd_all="git bundle create /opt/git-backups/${repo_name}-all.bundle --all" verify_command_all="git bundle verify /opt/git-backups/${repo_name}-all.bundle " echo -------- master only ------------------- ${backup_cmd} echo -------- all ------------------- ${backup_cmd_all} echo echo done 

关键是每隔几周在testing服务器上恢复testing。 包裹一些日志logging,每次使用它时都会得到报告,logging它生成的文件的校验和,每个文件的等待时间等。当世界在你周围燃烧,你需要恢复做准备现在会为你节省很多心痛。

请记住:它尚未备份,直到它已被恢复。

我不确定是否有任何“官方”备份git repo的方法,有很多备份git repo,tar,zip,文件系统转储等的方法,它将严重依赖于备份窗口的大小。