为什么git sparse checkout会留下目录? [英] Why does git sparse checkout leave behind directories?
问题描述
一些背景:我公司的服务模式最初是基于设备的服务器模型。我们会向我们的客户端发送一台带有Windows Server 2003/2008的服务器,预装了一个网络服务器和我们的软件。我们将所有客户端特定的配置转移到Git存储库,并使用稀疏检出来使每个服务器仅包含客户端软件正常运行所必需的内容。
设置稀疏检出时,我们遇到了巨大的不一致。我们会做
$ b $ pre $ g $ git clone git@github.com:ourclientconfigrepo.git。
git config core.sparsecheckout true
echo www.thisclient.com/> .git / info / sparse-checkout
git read-tree -m -u HEAD
预期的结果将是
ls
www.thisclient.com/
但我们得到
ls
www.thisclient.com/
www.randomclient1.com/
www.randomclient2.com/
www.randomclient3.com/
我已经尝试了多次,每次都在一个新目录中,并且每次都发生问题。我的ju-git-su在这里失败了。我们正在使用git 1.8.1.msysgit.1。
感谢您的帮助,请告诉我是否需要提供更多信息。
---编辑1 ---
澄清:存储库不过是我们客户端的配置目录。每个客户端在存储库中都有一个不同的目录,我们试图在每个客户端的个人服务器上进行稀疏检查,所以我们试图排除除有关客户端以外的所有内容。
---编辑2 ---
只是一个更新,事实证明这是Windows文件夹权限,Git试图删除非空目录。通过删除空文件夹来修复它。感谢任何和所有帮助的尝试! 解决方案
部分解决方案:根据,你可以排除特定的文件通过放一个!在文件名前面。这可能是一个错误,但是(这意味着这是对于目录,而不是文件)。
我会继续调查。
根据 https://stackoverflow.com/a/11222033/1210278 ,您可以手动标记 git update-index --skip-worktree www.randomclient1.com /
。
https://stackoverflow.com/a/9575837/1210278 意味着排除只适用于目录,并说它有一些错误。
Some background: My company's service model began as an appliance-based server model. We would send our client a server with Windows Server 2003/2008 on it, pre-loaded with a webserver and our software. We're moving all of the client-specific configuration to a Git repository, and using sparse-checkout to make each server only contain what's necessary for the client's software to function properly.
While setting up sparse-checkout, we've run into a huge inconsistency. We'll do
git clone git@github.com:ourclientconfigrepo.git .
git config core.sparsecheckout true
echo www.thisclient.com/ > .git/info/sparse-checkout
git read-tree -m -u HEAD
The expected result would be
ls
www.thisclient.com/
but we get
ls
www.thisclient.com/
www.randomclient1.com/
www.randomclient2.com/
www.randomclient3.com/
I've tried multiple times, in a new directory each time, and the issue has happened each time. My ju-git-su fails me here. We're using git version 1.8.1.msysgit.1.
Thanks for your help, let me know if I need to supply more information.
---EDIT 1---
Clarification: The repository is nothing but our client's configuration directories. Each client has a different directory in the repository, and we're trying to sparse-checkout on each client's individual server, so we're trying to exclude everything except for the client in question.
---EDIT 2---
Just an update, turns out it was something wonky with Windows folder permissions, and Git was trying to delete non-empty directories. Fixed it by deleting the empty folders. Thanks for any and all attempts at helping!
A partial solution: According to git-read-tree(1), you can exclude specific files by putting a ! in front of the file name. This may be a miswrite, however (meaning that that's for directories as well, not files).
I'll continue investigating.
According to https://stackoverflow.com/a/11222033/1210278, you can manually mark directories with git update-index --skip-worktree www.randomclient1.com/
.
https://stackoverflow.com/a/9575837/1210278 implies that exclusion is only for directories, and says that there are some bugs with it.
这篇关于为什么git sparse checkout会留下目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!