GitHub: Clone succeeded, but checkout failed
GitGithubGit SvnGit Problem Overview
I am having some problems working with
git clone
.The files are downloaded in my local git folder. Running the command
git checkout -f HEAD
gives me-
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'
Git Solutions
Solution 1 - Git
For me this was due to long file names and doing a simple config as below resolved it
git config --system core.longpaths true
Solution 2 - Git
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).
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.
Solution 3 - Git
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 *
After doing the two steps you should be able to see the project files.
Solution 4 - Git
Got the same error when trying to clone a repo from Visual Studio 2017 (v15.6.0).
In my case installing GIT-LFS locally solved the issue.
Solution 5 - Git
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:\
Solution 6 - Git
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.
For more info watch this - https://github.com/msysgit/msysgit/issues/208
Solution 7 - Git
In my case it was due to colons in filenames. Once I changed them, everything worked fine.
Solution 8 - Git
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.
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.
Solution 9 - Git
If you are on windows, you should do:
-
Go to Computer Configuration → Administrative Templates → System → Filesystem in
gpedit.msc
, openEnable Win32 long paths
and set it toEnabled
. -
After that
git config --system core.longpaths true
or editgitconfig
(you must run as administrator). -
Open project directory with
git bash
and rungit reset
after that rungit checkout *
Solution 10 - Git
This worked for me > git config --global core.longpaths true
Solution 11 - Git
It's happening because may be your files are too large. I tried to clone the repository through GitHub Desktop application and it solved my issue.
Solution 12 - Git
In my case - one file name was too long, I used the GitLab website to delete that particular file.
Then cloned again, it worked.
Solution 13 - Git
Solution 14 - Git
I had the same error, due to the fact that the antivirus of my computer was removing files between download and checkout (Excel with VBA macros in my case). Removing the problematic files from the remote branch solved the issue (or disable the antivirus if you can).