27

My xcode project has two repositories listed under the Source Control menu. One of them is a repository from an old project and should not be associated with the current project. However, I can not figure out how to remove it from the project.

NOTE: I have already removed this repository from Organizer.

Screenshot

Any help would be greatly appreciated.

bbrame
  • 18,031
  • 10
  • 35
  • 52

6 Answers6

32

I did this by manually editing the .xccheckout file.

Here are the steps that should work for you:

  1. quit Xcode, and make a backup of your project file.
  2. in the 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)
  5. make a backup of this file
  6. open the .xccheckout file in your favorite plain-text editor - this is a plist.
  7. find the IDESourceControlProjectWCConfigurations key, and look for the <dict> that has the name of the repository that you want to remove.
  8. in the same <dict> there is a key IDESourceControlWCCIdentifierKey whose value contains an identifier that looks like a UUID - this string identifies the repository.
  9. search the entire file for key/string pairs that have the ID as the key. delete all these pairs.
  10. delete the <dict>
  11. save the file
  12. 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.

Steven Grosmark
  • 1,275
  • 1
  • 12
  • 15
  • Ditto, thanks. My concern is that I'm not aware of where this – Nostradamus Feb 23 '15 at 23:59
  • Dude you saved me so much time! THANK YOU! – Ethan Allen Apr 23 '15 at 17:44
  • 2
    For me also helped cleaning `PROJECTNAME.xcworkspace/xcshareddata/PROJECTNAME.xcscmblueprint` – Apan Aug 19 '15 at 08:27
  • 1
    In Xcode 7.3, the file is YouProject.xcworkspace/xcshareddata/YourProject.xcscmblueprint. I removed the extra repository in 3 places: DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey, DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey, and DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey (the last one is an array inside the brackets [ and ], so you remove the entire entry for the repo between the inner braces { and }. Each place the repo is referenced, there is a UUID, so make sure you are deleting sections where ONLY that key is used (leaving the repo UUIDs you want to keep). – Ben Stahl Apr 03 '16 at 22:44
  • 5
    I dont have a xcsharedata folder, only xcuserdata – Aymon Fournier Jun 19 '16 at 05:06
  • 3
    @BenStahl Your answer worked for me on Xcode 9.2, but after carrying out your steps I also had to quit Xcode, then run `rm -rf ~/Library/Developer/Xcode/DerivedData/`. When I restarted Xcode, the remote repository was gone. – Francis Sep 18 '18 at 11:09
3
  1. Close XCode.
  2. Open Terminal.
  3. Navigate to the root directory of the project.
  4. Type find ./ -name .svn -exec rm -rf {} \;.
  5. Open your project.

Your project should be disconnected from all repositories. Now you may connect your project to the desired repository through Source Control -> Configure Project.

NOTE: The command searches for all filenames with extension .svn and removes (recursively and forcefully) all of them.

Abdurrahman Mubeen Ali
  • 1,331
  • 1
  • 13
  • 19
3

For those who their extra repositories are their old local modules (like local SPMs).

Assuming you already removed the original local package from the source file

  • Quit Xcode
  • Remove the derived data
  • Reopen the project

You can find the derived data location from the Xcode's preferences:

Preferences

Mojtaba Hosseini
  • 95,414
  • 31
  • 268
  • 278
0

You will have to manually remove the svn files from the old directory. This will be done using svn commands. You can find the commands below. How do you remove Subversion control for a folder?

Community
  • 1
  • 1
Nareshkumar
  • 2,331
  • 2
  • 20
  • 30
  • Thanks, @Nareshkumar, but the repository is for a different project. I don't want to remove the repository. I just don't want it to be associated with this xcode project anymore. – bbrame Sep 18 '13 at 15:18
0

Actually, if you start Xcode without loading anything and then check out a fresh copy of your project into a new workspace folder, the irrelevant repository info gets automatically removed in your local copy of the project.

I also recommend that you navigate to Xcode -> Source Control -> %Repository% -> Configure %ProjectName% and select the working branch in the branches panel - just to make sure the trunk|tags|branches folder locations are correctly initialised. (You'll see the repository menu item in the Source Control menu update after you hit done, and the sub menu will expand to give you more options).

It's then a simple matter of committing those changes Xcode has made back to the same repository. The diff tool should indicate the lines of XML from that .xccheckout file that have changed and not much else.

0

The way I solve this is

  • close the Xcode app
  • in finder go to the folder of the app and enter in it
  • in this place, you got to touch COMMAND + SHIFT + DOT keys this action will show all the files and folders hidden
  • now you see a folder called GIT? just select it and DELETE it!

That's the way to remove any GIT relation.

  • Now you can go to your terminal and inside your app folder type
  • git init

this will make a new GIT initialization of your stuff