I usually commit to a project from a macOS, and I didn't notice that leading and trailing space were embedded accidentally in folder names, but lately I tried to clone the repo from Windows, I get this error:
fatal: cannot create directory at 'FolderName /SubFolderName'
warning: Clone succeeded, but checkout failed.
Is there a way to checkout successfully from windows without modifying from the mac? What to do to prevent Leading and trailing spaces that cause checkout failure in Windows? Is there a way to force Finder to highlight all leading or trailing spaces in macOS ?, or even better: reject them for compatibility purposes?
Easiest would be to rename them in MacOS. But you can fix it in windows as well, using low-level commands:
git ls-tree HEAD:<parent dir>
or git ls-tree HEAD
if the directory is in toplevel, it would print something like "040000 tree df2b8fc99e1c1d4dbc0a854d9f72157f1d6ea078 invalid_dir"git update-index --add --cacheinfo 040000,df2b8fc99e1c1d4dbc0a854d9f72157f1d6ea078,valid_dir
git rm -r --cached 'invalid_dir '
git commit -m 'Rename invalid direct'
git reset --hard
(NOTE: I assume you have not any work done yet in this instance, so there is nothing to lose)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With