直接从 Xcode 4 上传源代码
我创建了一个 iPhone 项目,并启用了“为此项目创建本地 git 存储库”选项。最近我创建了一个 github 帐户。现在我想直接将我的代码提交到github,而不是我的本地存储库。我怎么能这样做呢?
I have created a iPhone project with option "Create local git repository for this project" enabled. Recently I created a github account. Now I want to directly commit my code to github, not to my local repository. How could I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Xcode 中的 git 集成有些限制。我个人只少量使用它。从技术上讲,您必须先将代码签入本地存储库,然后才能将其推送到远程存储库(但有些工具允许您同时执行这两项操作)。
不过,我建议使用 Tower 将代码推送到 github。它有一个简单的界面,可以非常方便地执行大多数常见的 git 任务:
(来源:git-tower.com)
如果你想使用免费客户端,还有原生的 Github mac client 显然与 github 配合得很好。
如果您需要执行更高级的操作,您可以随时恢复到终端
BTW:如果您想知道如何从本地存储库推送到终端中的远程位置,您可能会发现 可视化 Git 备忘单 有用:
The git integration in Xcode is somewhat limited. And I personally only use it marginally. Technically you have to checkin your code into your local repository first, before you can push it to a remote repository (But some tools allow you to do both at once).
However, I can recommend using Tower for pushing your code to github. It has a simple interface and does most of the common git tasks very conveniently:
(source: git-tower.com)
If you want to use a free client there is also the native Github mac client which obviously works well with github.
If you need to do more advanced stuff you can always revert to the Terminal
BTW: If you're wondering how to push from your local repository to a remote in the terminal you might find the Visual Git Cheet Sheet helpful:
使用 XCode 推送代码总是给我带来问题。所以最好的选择是使用终端推送代码。以下是将代码推送到 git hub 的步骤。
打开终端设置项目文件夹的路径。
使用命令 git commit --dry-run 检查修改后的文件或新文件。它将显示所有修改或新添加的文件。还有一些 Xcode 文件。
使用 git 命令添加新文件和修改的文件 git add "file1 path" "file2 path" 。如果您添加了新文件或更改了 Xcode 设置,也不要忘记添加 .proj 文件。
使用命令 git commit 提交文件。它将打开消息窗口。这样你就可以按 i 输入消息。一旦你写完消息,请按 :wq
运行命令 git push origin HEAD。
Pushing code using XCode always gives problem to me .So best option is to push code using terminal. below are the steps to push code to git hub.
open terminal set path to the project folder.
check for modified or new file using command git commit --dry-run . It will show you all the modified or newly added file .also some Xcode file.
add new files and modified files using git command git add "file1 path" "file2 path" .also don't forget to add .proj file if u have added new file or changed Xcode setting.
commit your file using command git commit. it will open message window. so you can enter message by pressing i. once you have written message press :wq
run command git push origin HEAD.