从Git中删除敏感数据。 “致命的:模棱两可的论点”rm“

我试图运行这个命令:

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch filename.js' --prune-empty --tag-name-filter cat -- --all 

但我不断收到这个错误:

 fatal: ambiguous argument 'rm': unknown revision or path not in the working tree . Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' 

尝试用双引号replace单引号,因为这可能有助于一些控制台shell, 例如

 git filter-branch --force --index-filter "git rm --cached --ignore-unmatch filename.js" --prune-empty --tag-name-filter cat -- --all