Untracked .idea folder won't be ignored.



I am trying to get the .idea folder ignored in my git repository, but nothing I've tried seems to work. When I run git status in the Rubymine terminal it shows this:


On branch change/MAIN-408
Untracked files:
(use "git add <file>..." to include in what will be committed)


nothing added to commit but untracked files present (use "git add" to track)


As it has never been tracked, running git rm -r --cached .idea is not useful.

I've tried adding a global gitignore, which I'm positive is correctly configured and I have a single line in it: .idea/ , but with no success whatsoever. I've also tried **/.idea/ and .idea/* but nothing seems to work.

The last thing I tried was adding the folder directly into the ignored files section of the version control settings in Rubymine with the "Ignore files under" option. Still won't work.


I don't know what else I can do. I might be missing something here but can't seem to detect it. Any help would be greatly appreciated.



could you please check whether you get any output for `git ls-files .idea` ran in the project's root?



No output for that command.


Are files from that folder listed in the Local changes tab (of the Version Control tab in RubyMine)? Which IDE version are you using? 


Oh, that might be it. I have all the files in the Unversioned Files list. Should I run git rm -r --cached <file-name> for each file or is there a better way to do it (if that's at all what I should do)?

RubyMine version is 2019.1.2, but I guess it doesn't matter because of the previous information.


Where is your .gitignore file is situated? Have you tried adding it to the project? It doesn't seem that files are added to git but for some reason git doesn't take into account your .gitignore file.



The .gitignore for the project is in the root of the project, as usual. The problem here is that this file is commited and I have read that it is good practice not to put IDE's information in it, so I'm taking the approach of my global gitignore. This decition is not up to me but to the project manager, so there's nothing I can do about that.
About the .gitignore_global, is located in C:\\Users\\izamudio\\.gitignore_global which is the same path configured in my .gitconfig in the excludesfile line.


.idea/ is the correct pattern to use. The fact it is not taken into account it means the path to the global config file is incorrect.

Git expects file path to exactly match the one configured in settings. So double check the C:\\Users\\izamudio\\.gitignore_global path is the correct. Make sure file extensions are not hidden.

It could happen the file is actually called .gitignore_global.txt or somewhat like this, and the path in the config do not match it 


Hi there. Thanks for your fast and patient support.


Turns out the problem was a silly one on my side (I'm sorry I made you lose time on this...). For some reason when I created the gitignore_global file I didn't put the dot at the begining (or I put it but it got removed).


So it was indeed a problem with the path. It is now properly working with the .idea/ pattern. Thank you very much for the help.


Please sign in to leave a comment.