.gitignore not working for xcuserdata directory in XCode project

This is my gitignore file:

# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/

However, it still detects changes here:

  • git push heroku master permission denied on VISTA
  • What is the git equivalent of Mercurial revsets?
  • How to I combine two separate Git repositories?
  • How git push other branch to remote/origin?
  • SASS files management in Git version control system in Ruby on Rails
  • Working with Eclipse .classpath and project files in Git?
  • BW.xcodeproj/project.xcworkspace/xcuserdata/cooluser.xcuserdatad/UserInterfaceState.xcuserstate
    

    This is on XCode 6.

    What am I doing wrong?

    Thanks!

  • Why does my Capistrano Deployment point to an old Commit?
  • How to config namespace for 'private' branches in git?
  • git pull generates “fatal: No remote repository specified.” error
  • Composer pulling latest commits on separate repos
  • How to git-revert only partially as in git-add -p?
  • How to download/clone a new branch from my server git repository into an already created local git repository in my PC with Eclipse EGit
  • One Solution collect form web for “.gitignore not working for xcuserdata directory in XCode project”

    The file BW.xcodeproj/project.xcworkspace/[...]/UserInterfaceState.xcuserstate must already be tracked by git.

    When you add an entry to .gitignore it only affects untracked files. If they are already tracked, they are not automatically removed from the repository.

    You can remove this file manually with: git rm --cached BW.xcodeproj/project.xcworkspace

    Git Baby is a git and github fan, let's start git clone.