如何使用远程 Git 存储库设置 Xcode

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7861163/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 22:12:15  来源:igfitidea点击:

How to Set Up Xcode with Remote Git Repository

xcodegitversion-control

提问by Rob

so I just installed a new remote git repository on one of our servers and want to move our old projects there. Our existing projects have local git repositories, and we can add repos from the server, but how do we move our existing projects onto the server?

所以我刚刚在我们的一台服务器上安装了一个新的远程 git 存储库,并希望将我们的旧项目移到那里。我们现有的项目有本地 git 存储库,我们可以从服务器添加存储库,但是我们如何将现有项目移动到服务器上?

Any ideas?

有任何想法吗?

回答by Adam Dymitruk

You would do these steps:

您将执行以下步骤:

Make the individual repositories on the server.

在服务器上创建单独的存储库。

git clone --bare nameofrepo

On the actual repo, add the remote to the repository from which you want to send up work:

在实际的 repo 上,将远程添加到要从中发送工作的存储库:

git remote add origin <url to your remote>

Now push your branch for your work:

现在为你的工作推送你的分支:

git push origin master

Repeat for any other branches you want to have pushed to the central repo.

对要推送到中央存储库的任何其他分支重复此操作。

The URL in the first command can also be a regular file path. Most solutions, however are through an SSH connection.

第一个命令中的 URL 也可以是常规文件路径。然而,大多数解决方案都是通过 SSH 连接。

回答by Tuyen Nguyen

After creating your Xcode project, cdto that directory
and make sure you are on the masterbranch
Type:

创建 Xcode 项目后,cd到该目录
并确保您在master分支上
键入:

git remote add origin <URL-of-your-GitHub-repository>
git pull
git branch --set-upstream-to=origin/master master
git merge
git commit -m "Merging with remote”
git push

Now your new project has been pushed to the remote GitHub directory.

现在你的新项目已经推送到远程 GitHub 目录。