IT박스

.gitignore는 .idea 경로를 무시하지 않습니다.

itboxs 2020. 9. 23. 07:27
반응형

.gitignore는 .idea 경로를 무시하지 않습니다.


git.idea/을 무시 하기 위해해야 ​​할 일이 무엇입니까 ?

ctote@ubuntu:~/dev/1$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   .idea/.name
    modified:   .idea/misc.xml
    modified:   .idea/modules.xml
    modified:   .idea/vcs.xml
    modified:   .idea/workspace.xml
    modified:   src/Receiver.java
    modified:   test/1/agent/WindowsQueryHandlerTest.java

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    lib/
    mp1.iml

no changes added to commit (use "git add" and/or "git commit -a")

ctote@ubuntu:~/dev/1$ cat .gitignore
*.class

# Package Files #
*.war
*.ear

# IDEA config files
.idea/

.gitignore 새로 추가 된 (추적되지 않은) 파일 만 무시합니다.

저장소에 이미 추가 된 파일이있는 경우 .gitignore 규칙과 일치하더라도 모든 변경 사항이 평소와 같이 추적됩니다.

저장소에서 해당 폴더를 제거하려면 (디스크에서 삭제하지 않고) 다음을 수행하십시오.

git rm --cached -r .idea

.idea/.gitignore 파일에 추가

터미널에서이 명령을 실행하여 임무를 완료하십시오. :)

git rm -rf .idea
git commit -m "delete .idea"
git push

fatal: pathspec '.idea' did not match any filesw0lf의 대답 을 얻는 사람들을 위해 :

.idea 폴더의 전체 경로를 포함하기 만하면됩니다.

따라서 먼저 현재 위치에 git status대한 경로를 표시하는을 수행하십시오 .idea.

그런 다음 w0lf 제안 명령에 경로를 포함하십시오. git rm --cached -r example/path/to/.idea


"심각한 : pathspec '.idea'가 파일과 일치하지 않음" 을 제거하려면 dir이 여전히 추적되지 않은 것으로 반환되는 경우 사용하십시오.

git clean -f -d .idea


위의 명령을 입력 한 후 "심각한 : pathspec '.idea'가 어떤 파일과도 일치하지 않음" 오류를 해결하려면 ,

  1. 아이디어 폴더와 파일의 경로를 확인하십시오.
  2. 이를 위해 git status. 평소와 같이 모든 파일을 나열합니다. 아이디어 폴더 파일의 경로를 확인하십시오. 나는에 있었다 ../.idea/workspace.xml. 주목../.idea
  3. 수락 된 답변에서 위의 제안 된 명령을 수정하십시오. git rm --cached -r ../.idea
  4. 그러면 이것을 볼 수 rm '.idea/workspace.xml'있고 파일이 제거됩니다.

참고 URL : https://stackoverflow.com/questions/32384473/gitignore-not-ignoring-idea-path

반응형