실제로 존재하는 파일을 제거 할 수 없음-치명적 : pathspec ... 파일과 일치하지 않습니다
자식 컨트롤 아래에 단순히 삭제되지 않는 파일이 있습니다. 실패한 명령은 다음과 같습니다.
$ git rm .idea/workspace.xml
fatal: pathspec '.idea/workspace.xml' did not match any files
아래에는 디렉토리 내용, 분기 등이 나열되어 있습니다. 지금까지 디렉토리 내에서 rm을 시도하고 재미있는 캐릭터가있는 경우를 대비하여 탈출했으며 실제로 혼란에 빠졌습니다. 웹과 SO를 검색했지만 구체적으로 찾을 수 없습니다. 미리 감사드립니다!
$ git branch -a
* dot-output
master
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/modelspace
$
$ git status
# On branch dot-output
# Untracked files:
# ...
$ ls .idea/
ant.xml encodings.xml modules.xml workspace.xml
compiler.xml inspectionProfiles scopes
copyright libraries testrunner.xml
dictionaries misc.xml vcs.xml
$ ls -al
total 56
drwxr-xr-x 16 matt staff 544 Apr 10 11:33 .
drwxr-xr-x@ 33 matt staff 1122 Apr 10 09:40 ..
-rw-r--r--@ 1 matt staff 12292 Apr 10 11:19 .DS_Store
drwxr-xr-x 18 matt staff 612 Apr 10 11:39 .git
-rw-r--r-- 1 matt staff 98 Mar 6 13:40 .gitignore
drwxr-xr-x 16 matt staff 544 Apr 10 11:34 .idea
-rw-r--r-- 1 matt staff 1113 Feb 25 11:07 README
...
$ head -n 2 .idea/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
$ git rm .idea/workspace.xml
fatal: pathspec '.idea/workspace.xml' did not match any files
최신 정보: Nevik과 Boris의 답변이 많은 도움이되었습니다. 나는 여러 가지 일로 혼란스러워했으며 IntelliJ IDEA (일반적으로 내가 좋아하는 도구 인 BTW)에 의해 악화되었습니다. 먼저, git rm의 'fatal : pathspec'메시지는 도움이되지 않고 오도 할 수 있습니다 (이 바닐라 사용자의 견해로는). 둘째, 파일은 .gitignore에 있지만 질문을하기 전에 파일을 제거했습니다. 그러나 그것은 또한 git와 독립적으로 IDEA의 Ignored Files 기능에 포함되었으며 프로젝트 뷰어에서 (git 상태가 보여주는 것처럼 추적되지 않는 대신) 보여졌습니다. 마지막으로 실험하는 동안 IDEA가 실행 중이며 rm 직후에 파일을 다시 작성하는 것처럼 보입니다. 따라서, Git 동작이 혼란스러워지면 디버깅하는 동안 IDEA를 종료하고 명령 줄 (및 gitk)에서 솔리를 작동시켜야합니다. 그리고 그 SO 사용자는 훌륭합니다. 다시 감사합니다!
git clean -f .idea/workspace.xml추적되지 않은 파일을 제거하는 데 사용할 수 있습니다 .

rm대신 파일을 단순히 제거하려고git rm했습니까?