The folder consists of files with filenames like abc~1
, 123~1
, a1d2~3
.
When I do git add --all
it says,
$ git add --all
error: Invalid path 'abc~1.png'
error: unable to add abc~1.png to index
fatal: adding files failed
I did a trial and error and I found this error persists only when the tilde symbol is followed by a number.
If the folder is tracked by git for the first time, the other files are also not tracked by Git.
$ git clean --dry-run
Would remove Rest.png
Would remove abc~1.png
Please help how do I fix this issue.
This is the result of a change that was made to msys Git in December 2014.
To disable this behaviour, you can run:
However, since the new behaviour is there to protect you, I’d recommend changing it back after having added your files:
Only disable this protection when you need to add files with tildes in the name or check out branches containing such filenames.
In general, I’d recommend avoiding such filenames if working in a Windows environment.