Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove a second remote git repo from an Xcode project?

Tags:

git

xcode

In working on a large client project, I added a couple of source files from one of my company's other projects (Debugging utilities.) Both projects are connected to remote repos.

I must have either dragged the file from the project window instead of the finder, or failed to click "copy files (if needed) in the add resulting dialog.

In any case, when I now go t push or pull, it lists both repos in the list of remote repos connected to the project.

I don't want my client's project tied to my company's other repository. I want all the files in the project to come from the client's repo.

I tried removing the source files that I added and then re-adding them with the "copy files" checkbox checked, but it still lists the other remote repo.

How do I get rid of the second, unwanted git repo from the project?

EDIT:

Note that the project is actually contained in an Xcode workspace. I just found a mention of the unwanted repo in my workspace's .xcworkspace/xcshareddata/.xcscmblueprint file.

like image 903
Duncan C Avatar asked Apr 01 '16 18:04

Duncan C


People also ask

How do I remove a remote git repository?

Use the git remote rm command to remove a remote URL from your repository.

How do I change my Xcode repository?

As mentioned in "Git XCode - change origin ", you simply can change the remote origin url, using git remote set-url (or in your case, rename+add). If that private repo is empty, you can push to the full history of your cloned repo.


2 Answers

So since the correct answer was never added here I'll do it myself: you have to delete the Xcode's Derived Data for it to forget about the link once you remove the references to other git repo's source files in the projects.

The easiest way to do so is to go to Xcode -> Preferences enter the Locations tab and press the little arrow beside Derived Data location (in the red box):

enter image description here

Just delete the entire folder (it's good to do so every once in a while to free up the space) and you are good to go!

like image 194
Alexander Telegin Avatar answered Sep 23 '22 16:09

Alexander Telegin


Try in the Terminal:

$ cd /my/project/folder
$ git remote

Now you know the names of the remotes.

$ git remote remove myUnwantedRemote

Of course all this is easy without Terminal if you use SourceTree.

like image 36
matt Avatar answered Sep 21 '22 16:09

matt