Reputation: 1929
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-
'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'
Upvotes: 108
Views: 286110
Reputation: 1423
In my case it was a trailing space in the file name, so git clone
failed on Windows. After space removing and pushing the changes from Linux, it started working on Windows too.
Upvotes: 0
Reputation: 1
you can configure Git to ignore the NTFS naming may fix the issue.
git config --global core.protectNTFS false
Upvotes: -2
Reputation: 109
Previous answers are correct. But if you have "permission denied" issues, they will not work, so you need the following:
git clone --config core.longpaths=true repository_url
So, you say that you do not set it globally, instead you set it just for this call. And the message will disappear also with permission denied.
Upvotes: 1
Reputation: 1321
Installing GIT LFS from its website works well for me. Steps are follows:
Upvotes: 0
Reputation: 43
If you are using Windows, make sure that the file name is not include in the system reserved name: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file
In my case it was a file named com9 which was causing issues.
Upvotes: 1
Reputation: 125
I was having this problem with git bash. Cloned in Ubuntu terminal instead using HTTP and not SSH and it worked immediately after I authenticated in the terminal.
Upvotes: 0
Reputation: 318
Go to the git clone folder and run this command
git restore --source=HEAD :/
Upvotes: 3
Reputation: 1014
In my case I solved this problem by :
git config --system core.longpaths true
git config --global core.protectNTFS false
resource list:
My drive was not Full
Upvotes: 16
Reputation: 140
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).
Upvotes: 0
Reputation: 10145
In my case - one file name was too long, I used the GitLab website to delete that particular file.
Then cloned again, it worked.
Upvotes: 0
Reputation: 196
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.
Upvotes: 0
Reputation: 63
If you are on windows, you should do:
Go to Computer Configuration → Administrative Templates → System → Filesystem in gpedit.msc
, open Enable Win32 long paths
and set it to Enabled
.
After that git config --system core.longpaths true
or edit gitconfig
(you must run as administrator).
Open project directory with git bash
and run git reset
after that run git checkout *
Upvotes: 4
Reputation: 2799
For me this was due to long file names and doing a simple config as below resolved it
git config --system core.longpaths true
Upvotes: 91
Reputation: 101
In my case it was due to colons in filenames. Once I changed them, everything worked fine.
Upvotes: 9
Reputation: 91
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:\
Upvotes: 9
Reputation: 2327
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
Upvotes: 6
Reputation: 2181
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.
Upvotes: 25
Reputation: 572
In my case my disk was not full and this is how I solved it:
git reset
git checkout *
After doing the two steps you should be able to see the project files.
Upvotes: 25
Reputation: 1929
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.
Upvotes: 3
Reputation: 11831
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.
Upvotes: 33