-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sparse-checkout does not appear to work on windows. "error: invalid path " #2803
Comments
This has come up before; the path names are checked when the corresponding files enter the Git index, even if the entries are not written out. See #2777 for more information (of which I think this here ticket is a duplicate). |
As an aside, I wondered if the clean and smudge style filters may offer a route to at least creating a valid local filename/path that could at least allow users to view the files. Maybe the file in the filesystem gets some sort of a symref/gitlink line to show it's 'real' path (and act as a pseudo flag for the smudge/clean filter). 'real' path being the repository path, rather than the local FS path. The 'problem' at the moment is that Git retains the filename/pathname, which makes it a no-go, but it could be sold to some in the linux community as a mechanism for avoiding having Word.doc files pollute their pristine FS, being replaced by a panadoc variant 😉 . just a thought. probably too many obstacles for the path mapping. |
@dscho was correct that#2777 was my issue and offers a bypass to the problem. At stated in the other issue: I've spent about 2 days trying to resolve the issue. I whole hardheartedly suggest that something be changed to prevent this in the future. Either a warning to set core.protectNTFS when sparse-checkout is specified or similar an enhancement to remap bad filepaths. With the frequency of hit's I have seen suggesting core.sparse-checkout to fix the error, you would be well advised to accept this issue or reopen #2777 . |
I will leave this ticket open all right, at the same time I encourage you to think about ways how you could bring the change about that you want to see. To give you a couple of pointers:
Note: the index entries are created only if their corresponding paths pass the Also note: the ... is to figure out how to delay the call to This, of course, has to be done with great care, as any regression in the safeguards would open users up for vulnerabilities that are no longer unknown (because they have been fixed as part of Git v2.24.1). |
@dscho What about using WSL git directly? |
I can imagine Git-for-Windows becoming a proxy to git in WSL. It would resolve this issue. All interoperability between different file systems will then be delegated to WSL team. Maybe as an experimental flag. |
What about it? If it works for you, that's good. In general, it is not really a solution for this here ticket. |
* Update puppet-keystone from branch 'master' to 4d17fb5dfb39b9f0f78635ce7560ee5900d9ab8a - Merge "Remove a file which causes cloning on Windows platform to fail" - Remove a file which causes cloning on Windows platform to fail There is a known issue with git-for-windows and currently clone and pull fail with invalid path errors if the target repository has any filename containing a character prohibited in Windows. We can find below examples reporting that issue. git-for-windows/git#2777 git-for-windows/git#2803 git-for-windows/git#2849 Because it is unlikely that the issue is solved in git-for-windows shortly, this change drops one release note file currently causing the failure, as a quick workaround. Note that we can't rename existing release note files because that would make notes appear in a wrong release, and this is why this change should remove that file. Change-Id: Ib3615761b366ed849177ae79d7d105ef8b839da4
There is a known issue with git-for-windows and currently clone and pull fail with invalid path errors if the target repository has any filename containing a character prohibited in Windows. We can find below examples reporting that issue. git-for-windows/git#2777 git-for-windows/git#2803 git-for-windows/git#2849 Because it is unlikely that the issue is solved in git-for-windows shortly, this change drops one release note file currently causing the failure, as a quick workaround. Note that we can't rename existing release note files because that would make notes appear in a wrong release, and this is why this change should remove that file. Change-Id: Ib3615761b366ed849177ae79d7d105ef8b839da4
And how would that help? Git would now understand those, but everything else, most notably the build system, would not. Which means that Git would all of a sudden pretend that it succeeded, but the users would now be faced with a totally broken checkout that none of their tooling handles (if they used Cygwin for their tooling, they would most likely use Cygwin's |
I'm getting this error on this path: I was able to run This happened to me after cloning a repo in windows. After clone, all files were deleted and all deletions staged, then this fails:
and this works:
Now if I turn it back on and try to
turning it back off does not work this time:
Is this a related to this issue? Or a different one? |
Not an invalid character, but an invalid name. (CON, PRN, AUX, CLOCK$, NUL COM0, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT0, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9) |
Ah, thank you! |
ProblemCurrently causes failures during github action Reproduction stepsI reproduced the error.
(those WorkaroundAccording to SO Answer https://stackoverflow.com/a/63742773/471376 , a workaround is I started a Q&A Discussion for calling Successful fix is here jtmoon79/super-speedy-syslog-searcher@2598719 |
For some definition of "workaround". It's like telling somebody to simply throw away their front door just because it creaks. Yes, the door won't creak anymore. But there are other consequences, too. |
Add windows-latest in os matrix. Workaround git-for-windows/git#2803 using `git config core.protectNTFS false` Issue #12
Add windows-latest in os matrix. Workaround git-for-windows/git#2803 using `git config core.protectNTFS false` Issue #12
Add windows-latest in os matrix. Workaround git-for-windows/git#2803 using `git config core.protectNTFS false` Issue #12
I have run into this issue as well, since I have filenames that contain a Right now I'm trying to run with this git config:
Checkout ( I tested using UDF as well, formatted with Interestingly, running Is there any way to successfully checkout ( |
That's because
The file name is not really truncated before the
That's because the Bash is not really a Win32 program. It is an MSYS program that derives certain hacks from Cygwin. For example the hack that characters that are not allowed in file names are automatically 'translated" into a private Unicode page. That works if you access the file via another MSYS program. But if you try to open that file from a regular Win32 using the name containing the So no, there is no good workaround. The problem is that there is no way to write files with names containing colons on Windows, and trying to do that anyway can only lead to a steady source of problems. |
The colon character is not allowed in file names on Windows. That is an operating system limitation, not a file system limitation. You could actually write a file whose name contains a colon on an NTFS file system (say, by mounting the file system in Linux, or using other tricks). But that would still not make it an allowed file name on Windows. |
Thank you for the detailed and clear explanation! 👍 The PUA (Private Use Area) workaround is interesting. Certainly explains what I observed with File Explorer after |
When I attempt to checkout a repository from github I get the error:
I suspect the issue is that the path contains a : which is illegal on Windows.
After researching the error, I've found 2 possible answers:
1) Change the path on the repository file. Unfortunately, this is is a team resource and can not be fixed in the foreseeable future.
2) Use sparse-checkout. I've tried this with no effect as evidenced in the following:
This was done with Git for Windows "git version 2.28.0.windows.1". I have also tried both types of line endings and using various version of .git/info/sparse-checkout such as:
Checkout works fine on Linux, MacOS and WSL, only problem is that my IDEs don't work in those environments. Why isn't sparse-checkout working on Windows. Is there any other possibilities? Given the number of hits I have encountered searching with Google, maybe the there should be an enhancement to git or fir-for-windows to allow filepath mapping.
Further dialog is ocuring at https://stackoverflow.com/questions/63727594/github-git-checkout-returns-error-invalid-path-on-windows
The text was updated successfully, but these errors were encountered: