Git error fatal: unable to stat '*': No such file or directory

前端 未结 6 1416
清歌不尽
清歌不尽 2020-12-15 03:25

I ran into this error, and found very little documentation on how to fix it online. I got the error by trying to run the command git add ., and received this re

相关标签:
6条回答
  • 2020-12-15 03:52

    Another cause for this problem on Windows might be reserved file names. I bumped on them when I tried to clone the Linux Kernel repository out of curiosity on my Windows 10 machine, and Git could not create aux.c and aux.h files.

    So you cannot create any file (with any extension) or folder named: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9, case insensitive.

    See: https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#naming-conventions

    0 讨论(0)
  • 2020-12-15 03:55

    I had the same issue. I'm using Windows 7 and my problem was the "Maximum Path Length Limitation" (max 260 characters for the path) (see http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx#maxpath for more details).

    My workaround was to shorten the classname a little bit.

    0 讨论(0)
  • 2020-12-15 03:56

    None of the above worked for me.

    Updating Git fixed the problem.

    0 讨论(0)
  • 2020-12-15 03:59

    To solve the problem, I removed the file from git, then re-added it by doing the following:

    git rm "myPathToAFile"

    git add .

    git commit -am 'my commit'

    Hope this helps someone else!

    0 讨论(0)
  • 2020-12-15 03:59

    Try git checkout my_branch -f

    As given here: http://www.nullreference.se/2010/08/20/git-merge-error-permission-denied/

    0 讨论(0)
  • 2020-12-15 03:59

    Similar to the comment by Tejes, I had this problem only with files called "aux.R", which I could not git pull onto a windows machine, while it works fine on my linux client.

    I fixed it by renaming it to "auxiliary.R", works now without any problem.

    0 讨论(0)
提交回复
热议问题