Reputation: 5362
I've accidentally got a file in my repo named :web,
. When typing git rm :web,
it seems to think the colon is a part of a command and not the start of a filename:
fatal: pathspec 'web,' did not match any files
Quotes don't make a difference.
Upvotes: 3
Views: 736
Reputation: 263217
Yet another alternative:
git rm ./:web
Prepending ./
to a name that refers to a file in the current directory makes it refer to the same file, but it doesn't have :
as the first character. (This also works for file names starting with -
.)
Note that this assumes that git rm
only treats the :
character specially if it occurs at the beginning of the file name. I think that's the case, but I haven't personally confirmed it.
Upvotes: 2
Reputation: 224864
You need to escape the :
(and not just in your shell, but for git
itself):
git rm '\:web,'
or
git rm \\:web,
Alternatively, you could use the :
-based pathspec that the error is telling you about. For example:
git rm :::web,
Upvotes: 5