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?
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.
Use the git remote rm command to remove a remote URL from your 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.
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):
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!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With