git中裸共享库的概念 [英] concept of bare shared repository in git
问题描述
它需要是一个裸回购,因为一个不光秃贱的回购会有一个工作树(这意味着该回购的特定版本签出并且文件可见)。
每次你推动一个非裸repo,你不能保证它的工作树会反映你正在推送的内容,因为默认情况下工作树不会被触及。
(想象一下,如果推动会触发工作树的更新:文件会突然改变,而没有来自接收端用户的任何控制)
这就是为什么裸露回购作为上游回购(您推to):没有工作树来管理/更新。
详情请参阅所有关于裸的回购s - 什么,为什么,以及如何解决非裸机推送。
它没有检出树,所以它只是做了服务器在集中式VCS中的概念 - 在你推送它时记录提交,分支等,并且当你克隆或提取它时给你最新版本。
I have been facing difficulty in understanding the bare repository . I have read everywhere that a shared repo is a bare repo. Why must it be a bare repo? Can't it be a normal repo which collaborators clone and then push/pull?
It needs to be a bare repo because a not bare repo would have a working tree (meaning a specific version of that repo checked out and with files visible).
Each time you are pushing to a non-bare repo, you have no guarantee that its working tree will reflect what you are pushing, since by default said working tree will be untouched.
(Imagine if a push would trigger an update of the working tree: the files would change all of a sudden without any control from users on the receiving end)
That is why it is simpler to have a bare repo as an upstream repo (one you push to): no working tree to manage/update.
See more at "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中裸共享库的概念的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!