Change Git Repository Of Existing Xcode Project

14,752

Solution 1

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).

git remote rename origin upstream
git remote add origin /url/of/private/repo

(with the XCode GUI, you could remove, then add again, the remote origin)

If that private repo is empty, you can push to the full history of your cloned repo.

By renaming 'origin' to 'upstream', you keep the possibility to fetch from the original repo, while pushing to your new origin target repo.

Solution 2

You can do it through UI

Select Source Control Navigator from the left pane

There you can find your current remote repo under the Remotes Folder,

select Current Remote

then delete the existing repo:

Delete Existing Repo

Now You can add Your Existing Remote

Add New Remote

Enter Remote URL

Enter Git Remote URL

Share:
14,752
Tom Metzger
Author by

Tom Metzger

College Student, Independent Developer and Security Researcher (iOS & OS X, namely) Programming Languages: Objective-C (4.5 years) Swift (4 years) Java (7 years) Python (3 years) C# (3 years) HTML5, CSS3, & JavaScript (4.5 years) Current Projects Revera - Nintendo 64 Emulator for iOS Mocha2D - Easy to implement game library for Java

Updated on July 21, 2022

Comments

  • Tom Metzger
    Tom Metzger almost 2 years

    I cloned an abandoned repository from Github, and now I want to be able to upload my changes to a private repo so that a few other people can work on the changes with me. Unfortunately, since I cloned it instead of making a fork, so Xcode is trying to make the commits to the original repo. Is there a way to change what repo the commits are being made to? If there is, would there be a way to change it to a repo on another website (Bit Bucket)?

    I fully intend to make the repo public once the changes are complete.