错误:稀疏签出在工作目录上没有任何条目 [英] error: Sparse checkout leaves no entry on working directory

查看:233
本文介绍了错误:稀疏签出在工作目录上没有任何条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,让我告诉您,我已经检查了所有类似的线程并搜索了google以查找可能是什么问题,但没有成功.我的问题是我正在尝试在git中使用稀疏签出,但出现此错误:

First, let me tell you that I have already checked all the similar threads and searched google to find what the problem may be, but no success. My problem is that I'm trying to use sparse checkout in git, but I get this error:

error: Sparse checkout leaves no entry on working directory

我有这个60GB的存储库,需要克隆它.我只需要其中的一部分,因此为了节省磁盘空间,我想使用稀疏签出.这就是我要做的:

I have this 60GB repository, which I need to clone. I need only a part of it, so to save a disk space I wanted to use sparse checkout. This is what I do:

  1. mkdir repoDir
  2. git init repoDir
  3. cd repoDir
  4. git remote add origin <repo url>
  5. git config core.sparsecheckout true
  6. echo "some/dir/" >> .git/info/sparse-checkout
  7. git pull --depth=1 origin master
  1. mkdir repoDir
  2. git init repoDir
  3. cd repoDir
  4. git remote add origin <repo url>
  5. git config core.sparsecheckout true
  6. echo "some/dir/" >> .git/info/sparse-checkout
  7. git pull --depth=1 origin master

注意,我添加了不带-f标志的遥控器,因此未获取任何内容.

结果:

error: Sparse checkout leaves no entry on working directory

我尝试了几件事:

  • 我执行了git clone --no-checkout,而不是初始化新的仓库和手动添加远程服务器,然后设置了稀疏签出.这无济于事,因为我的git status就像我删除了存储库中的所有文件一样. git pull origin master命令导致相同的错误.
  • 在步骤6中尝试了路径的所有可能组合,以及前面的斜杠,路径后的斜杠,星号,路径和>>>之间的空格.顺便说一句,我对这里的正确格式感到困惑,从对SO的评论中,我看到了相互排斥的格式化方式.
  • 试图确保我的.git/info/sparse-checkout是ASCII,并且具有正确的行尾,如此处.这可能只是在Windows上才有问题,但无论如何我还是检查了一下.
  • Instead of initialising new repo and adding the remote manually, I did git clone --no-checkout and then set up the sparse checkout. This didn't help as my git status showed as if I deleted all the files in my repo. The git pull origin master command results in the same error.
  • Tried all possible combination of paths in step 6, with preceding slashes, slashes after the path, stars, spaces between path and > or >>. Btw I'm confused what is the correct format here, from the comments on SO I see mutually exclusive ways of formatting this.
  • Tried to make sure my .git/info/sparse-checkout is ASCII, and has proper line endings as found here. This is probably only problematic on Windows, but I just checked this anyway.

我的git版本:git version 1.9.3 (Apple Git-50)

OSX优胜美地10.10.2(14C109)

OSX Yosemite 10.10.2 (14C109)

推荐答案

事实证明"some/dir/"是错误的,因为我没有存储库,所以我不知道它的真实结构.我可以通过Web界面对其进行浏览,但是我发现文件夹与真实的存储库文件夹结构不完全对应.

It turns out that "some/dir/" was wrong, since I didn't have the repository I didn't know it's real structure. I was able to browse it through web interface but I just discovered the folders don't correspond exactly to the real repository folder structure.

未来的经验:在创建sparse-checkout文件之前,请确保您了解文件夹结构.

Lesson for the future: make sure you know the folder structure before creating sparse-checkout file.

这篇关于错误:稀疏签出在工作目录上没有任何条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆