Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git - unable to create temporary file: no such file or directory - only for certain files?

Tags:

git

I've got a strange issue here with one of my git repositories. I cannot add certain files. Git states:

$ git add Konstruktion/Druckteile/1x_*
warning: CRLF will be replaced by LF in Konstruktion/Druckteile/1x_Hals.gcode.
The file will have its original line endings in your working directory.
error: unable to create temporary file: No such file or directory
error: Konstruktion/Druckteile/1x_Nickhalter_links.STL: failed to insert into database
error: unable to index file Konstruktion/Druckteile/1x_Nickhalter_links.STL
fatal: adding files failed

But only for this single file. All other files in the same directory, even with similar names (e.g. 1x_Nickhalter_rechts.STL) work like a charm. Why only this file? What's special about it?

What can I do to figure out what's wrong?

Ah, just for info: it's git 1.8.5.2.msysgit.0 running on Windows 8.1 (64bit).

Thanks a lot.

Cheers, Hendrik

like image 502
Hendrik Wiese Avatar asked Feb 07 '14 12:02

Hendrik Wiese


3 Answers

If you have "Controlled folder access" enabled in Windows 10, it might be the reason for this error.

You'd normally get a notification in the action center when such an action is blocked by Windows, similar to this:

To resolve that, press to open the start menu, and type "Controlled folder access" or part of it and launch it.
Click "Block history" and if git is there, give it access by clicking "Allow on device" (only present if not already configured - hence absent in the screenshot):

This solved the issue for me.

like image 158
Shimmy Weitzhandler Avatar answered Oct 20 '22 03:10

Shimmy Weitzhandler


I had the exact same problem when adding files. The following did the trick for me:

git config --global core.fscache false

Don't know exactly why it works but hopefully it can work for others.

like image 35
tocar Avatar answered Oct 20 '22 03:10

tocar


This worked for me:

export TMPDIR="/tmp/"

Yep, seriously. No idea what this actually did, but it worked, so I'm not exactly complaining. This might be a fix that only worked for me, because I can't reproduce the problem now that I've fixed it.

If the problem recurs when you relog, put it at the bottom of your ~/.bashrc.

like image 6
SIGSTACKFAULT Avatar answered Oct 20 '22 03:10

SIGSTACKFAULT