I was trying to clone a repository from gitbucket client when I got this error on my PC
git -c filter.lfs.smudge= -c filter.lfs.required=false -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks clone --branch master https://JumboDaniel@bitbucket.org/fedacash-dev/fedhagap-web-ui.git C:\Users\hp\Documents\HTML\Jobs\Fedha
Cloning into 'C:\Users\hp\Documents\HTML\Jobs\Fedha\...
error: invalid path 'src/Assets/fonts/TTF/THICCCBOI-Black.ttf:Zone.Identifier'
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'
I tried working my way around the issues; I even tried deleting the 'THICCCBOI-Black.ttf' file from the gitbucket repo, but this didn't solve the issue.
After hours of searching through the internet, I found the cause of the error:
The Git cloning of a repository fails on Windows with an "invalid path" error because the Windows OS reserves some filenames; hence, a file name may be legal in Linux or Mac (in my case) but illegal in Windows.
**
Solution:
**
Whilst this may workaround the issue, care should be taken as the default for a Windows client was set to core.protectNTFS=true to close a potential security issue CVE-2019-1353 as described here.
Depending on the filename, you can configure Git to ignore the NTFS naming may fix the issue.
git config --global core.protectNTFS false
Turning off protectNTFS will stop Git from complaining about files that have a base name that is reserved but will not prevent an error if the filename is one of the reserved names.
The best solution is to:
- Identify the offending file(s) mentioned in the error message, such as ('src/Assets/fonts/TTF/THICCCBOI-Black.ttf:Zone.Identifier') as in my case.
- Rename the file(s) to something that does not conflict with any reserved names. For example, I can rename it to 'THICCCBOI-Black-Font.ttf'. NB. Check windows file naming documentation here
- Update the reference to the renamed file(s) in your code or configuration, if necessary.
- Commit the changes to the repository.
Reference:Link
Top comments (6)
Respect!
Thank You
Thank you, what a hero! I was struggling with this problem for far too long. Your solution fixed it.
Legend!
good one
Thank You