github/git Checkout Returns 'error: invalid path' on Windows
Solution 1:
After I opened an issue on the git-for-windows bug tracker (https://github.com/git-for-windows/git/issues/2803), I found that my issue had already been filed as https://github.com/git-for-windows/git/issues/2777. That issue suggested that I need to set another git flag:
git config core.protectNTFS false
This (#2777) indeed contains a bypass for the my problem. I hope the git or git-for-windows (who were very responsive) come up with a better warning message, or even a true fix like a filepath mapping scheme.
Note that this is only an issue when using sparse-checkout with windows.
Solution 2:
I have experienced a similar problem, trying to checkout a repository from GitHub that contained files with a ":" in the name, on a Windows. (example file name that caused the problem: "test-img.jpg:Zone.Identifier"). The repo downloaded, but the files were not showing up in the folder.
I found that running git config core.protectNTFS false
solved my issue, but only if I took some steps before and after running it. The entire process went like so:
- Clone the Git repository locally;
- 'cd' into the local Git repository folder that has just been cloned;
- Run
git reset
- Run
git config core.protectNTFS false
- Run
git checkout
(just git checkout, no * at the end of command).
After that, I could see the files. Granted, some extra things downloaded from Git that are usually omitted, but it wasn't a big deal in my case.
Solution 3:
In our case there was a filename aux.go
and windows doesn't allow the creation of a file that has the word aux
Read more about this issue here