Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Git Repository Of Existing Xcode Project

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.

like image 789
Tom Metzger Avatar asked Feb 02 '15 06:02

Tom Metzger


2 Answers

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

like image 186
Blue_Alien Avatar answered Nov 15 '22 22:11

Blue_Alien


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.

like image 40
VonC Avatar answered Nov 15 '22 23:11

VonC