15

What I am trying to do is a git clone on windows, but the parent repository exists in a unix machine.

Am cloning using ssh to get a clone from UNIX to windows, and I get this weird error.

error: git checkout-index: unable to create file <filename>

This happens during the checkout step of a git clone.

Can anyone help me?

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
Senthil A Kumar
  • 10,306
  • 15
  • 44
  • 55
  • 1
    I faced the same problem while cloning linux-next tree on Windows machine. It gives error: "error: unable to create file drivers/gpu/drm/nouveau/core/subdev/i2c/aux.c (No such file or directory)" I still dont know the reason why it fails and each time at same file. – Adil Nov 06 '12 at 05:57
  • See also http://stackoverflow.com/questions/14811991/git-checkout-error-unable-to-create-file. – Vacilando Apr 28 '14 at 14:53

4 Answers4

26

The answer should be:we can't create a file named aux.c in windows!

See http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx Do not use the following reserved device names for the name of a file: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended. For more information, see Namespaces.

Dexuan
  • 380
  • 3
  • 5
  • Well [I can](https://www.dropbox.com/s/sc4l4d77087p4k9/waux.png?dl=1) why git can't, I wonder? – Andrew Savinykh Aug 13 '15 at 08:33
  • This worked for me. renamed con.js and was good to go! Thanks! – drj Nov 08 '15 at 01:44
  • @zespri probably because git for windows uses some Windows API which filters such filenames. `touch aux.c` in git bash works, for example. But creating such file in `explorer` results in an error. – andrybak Nov 10 '15 at 12:10
7

Was your directory plus your filenames too long for Windows? I came across this problem once, and it was fixed when I tried cloning into a lower directory.

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
  • I came across the same problem before where the length of the address in windows was more than 256 or something, but now this error comes for many files which are not too deep. Thanks for the suggestions...Any other causes? – Senthil A Kumar Nov 01 '10 at 07:10
  • @Senthil: Could it be the length of the individual filename itself? I wouldn't be surprised if the length of individual filenames may have a lower limit than that. – Andrew Grimm Nov 01 '10 at 08:03
2

A common problem is two files whose names differ only by case — git assumes a case sensitive system. If the repository contains both FOO and foo, then attempting to create one after the other will fail.

Josh Lee
  • 171,072
  • 38
  • 269
  • 275
1

Maybe related to Git checkout and reset on Windows occasionally shows random files have changed

Community
  • 1
  • 1
gawi
  • 13,940
  • 7
  • 42
  • 78