git - git 中裸共享存储库的概念

标签 git repository git-bare

我一直难以理解裸存储库。我到处都读到共享 repo 是一个裸 repo 。为什么它必须是一个裸仓库?它不能是协作者克隆然后推/pull 的普通存储库吗?

最佳答案

它需要是一个裸仓库,因为一个非裸仓库会有一个工作树(意味着该仓库的特定版本已 check out 并且文件可见)。

每次你推送到一个非裸仓库时,你不能保证它的工作树会反射(reflect)你正在推送的内容,因为默认情况下所述工作树将保持不变。
(想象一下,如果推送会触发工作树的更新:文件会突然发生变化,而接收端的用户没有任何控制)

这就是为什么将裸仓库作为上游仓库(您推送到的仓库)更简单的原因:无需管理/更新工作树。

在“all about "bare" repos -- what, why, and how to fix a non-bare push”中查看更多信息。

It doesn't have a checked out tree, so it just does what the "server" notionally does in a centralised VCS -- records commits, branches, etc when you push to it, and gives you the latest versions when you clone or pull from it.

关于git - git 中裸共享存储库的概念,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24115224/

相关文章:

git - 裸 git repo 的 GUI

java - Android Studio 中定义多个 dex 文件

git - 为什么 tortoisemerge 不能用作我的 merge 工具?

repository - 设置共享 Ivy 存储库

git merge 裸仓库中的分支

git - 将东西添加到 git 裸存储库

regex - 如何找到所有 .git\config 文件?

git - 如何通过ssh将git repo推送到远程服务器?

repository - 如何构建 CQRS 应用程序的查询端?

android - git push 如何与 android 的 repo 工具一起工作?