What am I missing that needs to be done in order to get git
to ignore my .idea/
path?
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/
For those of you getting
fatal: pathspec '.idea' did not match any files
with w0lf's answer:You just have to include the full path to the .idea folder.
So first, do a
git status
, which should show you the path to.idea
given where you currently are.Then, include the path in the command w0lf suggested:
git rm --cached -r example/path/to/.idea
add
.idea/
to .gitignore filerun this commands in terminal to complete mission :)
To Solve Error "fatal: pathspec '.idea' did not match any files" after entering above command,
git status
. It will list all the files as usual. Check the path of idea folder files. Mine was at../.idea/workspace.xml
. Notice the../.idea
git rm --cached -r ../.idea
rm '.idea/workspace.xml'
and the files will be removed.To remove the "fatal: pathspec '.idea' did not match any files" just use if the dir still returns as untracked:
git clean -f -d .idea
.gitignore
only ignores newly added (untracked) files.If you have files that have already been added to the repository, all their changes will be tracked as usual, even if they are matched by .gitignore rules.
To remove that folder from the repository (without deleting it from disk), do: