Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ashikahmad/9eaec85e3bcf9f361b8f to your computer and use it in GitHub Desktop.
Save ashikahmad/9eaec85e3bcf9f361b8f to your computer and use it in GitHub Desktop.
Removing unexpected repository from XCode source control

Here are the steps that should work for you:

This steps are copied from pocketlogic's answer at StackOverflow

  1. Quit Xcode, and make a backup of your project file ( projectName.xcodeproj ).
  2. In Finder, right-click on your project file and select Show Package Contents.
  3. Right-click on the project.xcworkspace file, and select Show Package Contents.
  4. In the folder named xcshareddata, there is a file with the extension .xccheckout (it should have the same name as your main project file, but with the .xccheckout extension). Open the .xccheckout file in your favorite plain-text editor - this is a plist.
  5. Find the IDESourceControlProjectWCConfigurations key, and look for the <dict> that has the name of the repository that you want to remove. In the same <dict> there is a key IDESourceControlWCCIdentifierKey whose value contains an identifier that looks like a UUID - this string identifies the repository.
  6. Search the entire file for key/string pairs that have the ID as the key. Delete all these pairs. Delete the <dict>. Save the file.
  7. Delete .git, .svn etc. any version controlling system folder (hidden) from them folder of the unexpected repo so that it sould not be autometically added again by XCode.
  8. Re-open the project in Xcode, and make sure everything is good.

If it is still showing up, make sure that none of the files in your project are located in the directory of the old repository (via an absolute file reference). You can investigate this by opening up the main file project.pbxproj, which is inside your project file.

You can also test this out by temporarily renaming the root folder (in the Finder) of the old repository, and if the repository no longer shows up in the Source Control menu, then you have a file in your project that is located in that old repository.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment