.gitignore not ignoring .idea path

前端 未结 9 1949
无人及你
无人及你 2021-01-29 18:29

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         


        
相关标签:
9条回答
  • 2021-01-29 18:39

    add .idea/ to .gitignore file

    run this commands in terminal to complete mission :)

    git rm -rf .idea
    git commit -m "delete .idea"
    git push
    
    0 讨论(0)
  • 2021-01-29 18:42

    check this if git status still shows .idea even if .idea/* is already added in your .gitignore file

    0 讨论(0)
  • 2021-01-29 18:42

    Remove the file from the repository run below command

    git rm --cached .idea/
    

    now update your gitignore file to ignore .idea folder run below command

    echo '.idea' >> .gitignore
    

    add the .gitignore file

    git add .gitignore
    
    git commit -m "Removed .idea files"
    
    0 讨论(0)
  • 2021-01-29 18:43

    If, after following steps from other answers, you still find that your instance of git running in bash or powershell just keeps on tracking the .idea/ folder, then try this!

    I discovered that Jet Brains IDE's have their own .gitignore, and run their own instance of git that will override your .gitignore settings!

    What I did to fix this was to navigate to /.idea/.gitignore, and change its contents to:

    /**
    

    so as to ignore everything in the folder.

    The image below shows how you can navigate to the .gitignore file from within your Jetbrains IDE.

    0 讨论(0)
  • 2021-01-29 18:48

    .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:

    git rm --cached -r .idea
    
    0 讨论(0)
  • 2021-01-29 18:48

    For ignoring .idea folder and iml file types, I did the following:

    0 讨论(0)
提交回复
热议问题