Git bare - 备份什么?
如果其他地方对此进行了介绍,我很抱歉,但我找不到答案。
我有一个名为 bare.git 的裸存储库,它是从中克隆开发存储库的存储库。一切都运转良好。
我想知道 bare.git 从哪里获取源文件。它们是否作为二进制文件存储在 bare.git 文件结构中?我可以将 bare.git 移动到另一个位置,并且仍然从中克隆存储库,因此源在某种程度上必须是可移植的。或者它是否存储对文件的绝对网络引用?
我想知道这些信息有三个主要原因:
- 我们需要知道要备份什么。
- 我的老板想知道源代码去了哪里。
- 我们需要一个当前的复合版本来进行测试。
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:
- We need to know what to backup.
- My boss wants to know where the source code has gone.
- We need a current composite version for testing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的源文件作为 bare.git 文件结构内索引的一部分存储,这与任何克隆中的 .git 目录中的相同。
因此,最好备份完整的 bare.git。
您可以通过克隆裸存储库来获取当前版本进行测试。
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.
为什么您不备份所有存储库?
请参阅 Git 对象模型 和 Git 如何存储对象。
Why would you not backup all of the repo?
See The Git Object Model and How Git Stores Objects.
备份整个 bare.git 文件夹以免错过,以后您可以随时克隆它。
当您想测试源代码时,您需要克隆它。 使用 Git 管理网站一文向您展示了一种处理该问题的方法: 每次推送到 bare.git 后都会自动检查整个存储库,当然是自动的。此代码是您应该测试的内容(除非您想在推送到 bare.git 之前、在预提交或预接收中执行此操作)。
Backup the whole bare.git folder not to miss out, you could always clone it later.
When you wish to test source code, you need to clone it. The article Using Git to manage a web site shows you one way to deal with the issue by checking out the whole repo after each push to bare.git, automatically of course. This code is what you should test (unless you'd like to do that before pushing to bare.git, in pre-commit or pre-receive.