hhrzc
hhrzc

Reputation: 2050

gitignore file not hide .idea directory for github

I have a project with gitignore file:

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
Temp*
RationalValues*

https://github.com/hhlTer/quadraticEquation

but .idea directory still pushed in my repository...why?

This makes coding very difficult and inaccessible in branches.


I did add to gitignore all files from .idea, but all files still in repository

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
Temp*
RationalValues*
compiler.xml
encodings.xml
misc.xml
uiDesigner.xml
vcs.xml
workspace.xml

Upvotes: 2

Views: 2048

Answers (3)

BartmanDilaw
BartmanDilaw

Reputation: 415

You may had a "/" character after each directory reference. To ignore .idea directory, you have to write

.idea/

Upvotes: 0

Søren Falch
Søren Falch

Reputation: 111

.gitignore will only make git ignore files in your local repository, and will not apply to files already pushed to the remote repo.

If you wish to remove the files from the remote repository, you can use git rm --cached -r .idea

Please also see this answer

Good luck! :-)

Upvotes: 5

Gustavo Lopes
Gustavo Lopes

Reputation: 4174

If they are being pushed, it means they were added at some point to your git.

To ignore them, you must remove them from your repository first, commit the changes and then they won't be added again, as they are on the .gitignore.

To remove the files from git without deleting them, you can do: git rm -r --cached .idea

Please, find more about here: http://www.codeblocq.com/2016/01/Untrack-files-already-added-to-git-repository-based-on-gitignore/

Upvotes: 5

Related Questions