.gitignore not working for xcuserdata directory in XCode project

This is my gitignore file:

# Xcode

However, it still detects changes here:


This is on XCode 6.

What am I doing wrong?


  • How to give friend access to git repository without giving command line access?
  • Getting 'no such module RealmSwift' error after taking a checkout of the code
  • Source Control merge button grayed out?
  • The operation could not be performed because “PROJECTNAME” has one or more tree conflicts
  • Getting a 403 response when trying to run 'pod setup'
  • git clone fails: missing delta bases
  • xcodeproj under version control
  • Does Xcode take care of multiple .git in sub-folders nicely?
  • 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.