git GitHub:克隆成功,但结帐失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22041752/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
GitHub: Clone succeeded, but checkout failed
提问by jamie_y
I am having some problems working with
git clone
.The files are downloaded in my local git folder. Running the command
我在使用git clone
.The 文件时遇到了一些问题,
这些文件已下载到我的本地 git 文件夹中。运行命令
git checkout -f HEAD
gives me-
git checkout -f HEAD
给我-
Error:
错误:
'The unable to write new index file error caused by the lack of disk space'.
'由于磁盘空间不足导致无法写入新的索引文件错误'。
I've manually removed big files from my computer, but still getting the same error.
我已经从我的计算机中手动删除了大文件,但仍然出现相同的错误。
Cloning into 'ffmpeg'...
remote: Counting objects: 7890, done.
remote: Compressing objects: 100% (4412/4412), done.
Receiving objects: 100% (7890/7890), 299.75 MiB | 24.19 MiB/s, done.
remote: Total 7890 (delta 3346), reused 7846 (delta 3317)
Resolving deltas: 100% (3346/3346), done.
Checking out files: 100% (7019/7019), done.
fatal: unable to write new index file
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'
采纳答案by vonbrand
When you clone, git gets all the objects from the remote end (compressed and stashed into the .git
directory). Once it has all the pieces, it proceeds to unpack all files needed to (re)create the working directory. It is this step that fails, due to not having enough space. This might be due to a disk that is full, or a disk quota exceeded (on shared machines, quotas are often enforced to avoid having users grab more than their fair share of space).
克隆时,git 会从远程端获取所有对象(压缩并保存到.git
目录中)。一旦它拥有所有部分,它就会继续解压缩(重新)创建工作目录所需的所有文件。由于没有足够的空间,这一步失败了。这可能是由于磁盘已满或超出磁盘配额(在共享计算机上,通常强制执行配额以避免用户占用的空间超过其公平份额)。
Delete your cruft. Make sure you aren't trying to squeeze the Linux kernel or some such monster repository into your few megabytes of account space.
删除你的垃圾。确保您没有试图将 Linux 内核或某些此类庞大的存储库压缩到您的几兆帐户空间中。
回答by user3579815
In my case my disk was not full and this is how I solved it:
就我而言,我的磁盘未满,这是我解决的方法:
- cd into the project directory and un-stage all staged files if any by running
git reset
- undo all changes in the working directory by running
git checkout *
- cd 进入项目目录并通过运行取消暂存所有暂存文件(如果有)
git reset
- 通过运行撤消工作目录中的所有更改
git checkout *
After doing the two steps you should be able to see the project files.
完成这两个步骤后,您应该能够看到项目文件。
回答by jamie_y
I solved the problem. It turns out that my disk was full. You can find out by running
我解决了这个问题。原来我的磁盘已满。你可以通过运行找到
quota
My result said
我的结果说
$ quota
Home Area quota for: jamie_y
Current Usage: 8 GB
Current Limit: 8 GB
Run du command to find your disk usage.
运行 du 命令以查找您的磁盘使用情况。
The du command shows the disk space used by the files and directories in a directory. The -h option makes the output easier to read, and the -s option summarizes the result. For example,
du -h -s (quoted from http://linux.about.com/od/commands/a/blcmdl1_dux.htm)
Run rm -rf folderName to remove the folder/file.
运行 rm -rf folderName 删除文件夹/文件。
回答by Gustavo Braga
I recently had this problem and the error was that the path of the file where I was cloning the repository was too large, you can do a test by cloning the repository into some folder in C:\
我最近遇到了这个问题,错误是我克隆存储库的文件路径太大,您可以通过将存储库克隆到 C:\ 中的某个文件夹来进行测试
回答by salle55
回答by Gaurav Khare
Apart from other possibilities, the major one could be rules imposed by windows on naming files. The git clone and checkout should work fine on linux.
除了其他可能性之外,主要的可能是 Windows 对命名文件施加的规则。git clone 和 checkout 在 linux 上应该可以正常工作。
For more info watch this - https://github.com/msysgit/msysgit/issues/208
有关更多信息,请观看此 - https://github.com/msysgit/msysgit/issues/208
回答by Paschal Amah
In my case it was due to colonsin filenames. Once I changed them, everything worked fine.
在我的情况下,这是由于文件名中的冒号。一旦我改变了它们,一切都很好。
回答by Jai Prakash
For me this was due to long file names and doing a simple config as below resolved it
对我来说,这是由于长文件名和做一个简单的配置如下解决它
git config --system core.longpaths true