Xcode Source Control showing multiple Working Copies

Xcode is showing multiple working copies:

Working Copies
myProject - master
myProject_olderRepo
myProject_originalRepo

The second two are greyed out.

The original code was cloned in Sourcetree from the repo of a previous owner. Not knowing how to move the files into a new repo, I simply copied locally the entire project directory, and started work on them. Then I copied the contents of that reworked project directory into a folder linked to a repo to which others have access. When they clone the repo they get compile errors because modules (the two older repos) are missing.

I have almost no experience of source control and Bitbucket et al, so I humbly ask forgiveness for anything completely stupid that I am doing.

How do I remove those older working copies from Xcode's source control? Or is there some other way that others can then clone and compile the project without errors?


Solution 1:

Solved this by deleting xccheckout file under

ProjectName.xcodeproj > project.xcworkspace > xcshareddata

This had contained references to the previous repos.

Solution 2:

I have removed old repo using following steps.

  • ProjectName.xcodeproj -> Show Package Contents
  • project.xcworkspace -> Show Package Contents
  • xcshareddata
  • Open .xcscmblueprint file using any text editor
  • Remove all unrequited repo from following location DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey
  • Save file and open Xcode again

Note : If your project have WorkSpace then Direct click on ProjectName.xcworkspace instead of ProjectName.xcodeproj

Solution 3:

I am using Cocoapods and have a .xcworkspace along with my .xcodeproj.

This is what worked for me:

  1. Remove Cocoapods from the project using pod deintegrate in Terminal.
  2. Run pod clean
  3. Run pod install to create it again.

Now if you open the Workspace again, the other Working Copies should no longer exist.

Solution 4:

This solution helped me. Go to terminal and paste below code (this will show hidden files)

defaults write com.apple.finder AppleShowAllFiles YES.

Now go to your project folder and check if there is any .git files outside your working project folder. enter image description here

.git file that is located outside project folder do not belong to your working project but other project. ( This is possible if you have made mistake in creating git for other project)

Either cut paste this .git file and save it some other location or you can delete it (if not so important). After deleting , reopen your project in xcode.