简体   繁体   English

更改现有Xcode项目的Git存储库

[英]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. 我从Github克隆了一个废弃的存储库,现在我希望能够将所做的更改上传到私有存储库,以便其他一些人可以与我一起处理更改。 Unfortunately, since I cloned it instead of making a fork, so Xcode is trying to make the commits to the original repo. 不幸的是,由于我克隆了它而不是创建了fork,所以Xcode试图对原始存储库进行提交。 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. 更改完成后,我完全打算公开该回购协议。

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 XCode-更改origin ”中所述,您只需使用git remote set-url (或在您的情况下,重命名+添加)即可更改远程origin url。

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 ) (使用XCode GUI,您可以删除远程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. 通过将“ origin ”重命名为“ upstream ”,您可以从原始存储库中获取数据,同时推送到新的origin目标存储库。

You can do it through UI 您可以通过UI进行操作

Select Source Control Navigator from the left pane 从左窗格中选择“源代码管理导航器”

There you can find your current remote repo under the Remotes Folder, 在这里,您可以在“远程文件夹”下找到当前的远程存储库,

选择当前遥控器

then delete the existing repo: 然后删除现有的仓库:

删除现有回购

Now You can add Your Existing Remote 现在,您可以添加现有的遥控器

添加新的遥控器

Enter Remote URL 输入远程URL

输入Git远程URL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM