简体   繁体   English

如何使用Xcode 4克隆到远程git存储库

[英]How to clone into a remote git repository using Xcode 4

Dear all I'm trying to upload my code to a git repository at sourceforge.net. 亲爱的,我正在尝试将我的代码上传到sourceforge.net上的git存储库。 I used Xcode 4's version editor to make a local git repository to manage my code. 我使用Xcode 4的版本编辑器来创建一个本地git存储库来管理我的代码。 Now, I want to release my code to the remote repository. 现在,我想将我的代码发布到远程存储库。

I'm trying to clone it. 我正在尝试克隆它。 When I try to use the clone command in Xcode 4. It seems to me its only for cloning into local drive. 当我尝试在Xcode 4中使用clone命令时。在我看来,它只能用于克隆到本地驱动器。

I tried from the command line. 我试过命令行。 its says that I'm trying to clone a empty repository. 它说我正在尝试克隆一个空的存储库。

Can anyone help? 有人可以帮忙吗?

In order to upload your code from an Xcode project into sourceforge, you want to push the content, not clone the empty repository from sourceforge. 为了将代码从Xcode项目上传到sourceforge,您需要推送内容,而不是从sourceforge克隆空存储库。 Remember that you should be adding and committing all your files to your local git repository before trying to push content to sourceforge. 请记住,在尝试将内容推送到sourceforge之前,您应该添加所有文件并将其提交到本地git存储库。 On the command line, use git add * and git commit -m 'My commit message to get them all added and checked in (or the equivalent commands in Xcode 4). 在命令行中,使用git add *git commit -m 'My commit message将它们全部添加并签入(或Xcode 4中的等效命令)。

This is taken from http://sourceforge.net/apps/trac/sourceforge/wiki/Git : 这取自http://sourceforge.net/apps/trac/sourceforge/wiki/Git

How to push a local repository 如何推送本地存储库

If you did not clone one of our remote repositories (for instance, if your older git version won't let you clone an empty repository), you will have to take some manual setup steps to be able to push your content to our servers. 如果您没有克隆我们的远程存储库(例如,如果您的旧版git版本不允许您克隆空存储库),则必须采取一些手动设置步骤才能将内容推送到我们的服务器。

For any local Git repository, you can configure it to push data back to our server by doing the following from inside your Git repository (this replicates what a "git clone" from our servers sets up for you automatically): 对于任何本地Git存储库,您可以将其配置为通过从Git存储库中执行以下操作将数据推送回我们的服务器(这将复制我们的服务器中的“git clone”自动为您设置):

git remote add origin \\ ssh://USERNAME@PROJECTNAME.git.sourceforge.net/gitroot/PROJECTNAME/REPONAME git remote add origin \\ ssh://USERNAME@PROJECTNAME.git.sourceforge.net/gitroot/PROJECTNAME/REPONAME

git config branch.master.remote origin

git config branch.master.merge refs/heads/master

Now you're ready to push the committed files to our servers: 现在您已准备好将提交的文件推送到我们的服务器:

git push origin master

Note: The use of "origin master" prevents Git from complaining that the remote server has no branches in common with your local repository (which is true at the start when the remote repository is completely empty), and "master" is the default branch in Git. 注意:使用“origin master”可以防止Git抱怨远程服务器没有与本地存储库相同的分支(在远程存储库完全为空时在开始时为true),并且“master”是默认分支在Git。

After the first push, you will be able to use the simpler "git push" to push the master branch to our "origin" server. 在第一次推送之后,您将能够使用更简单的“git push”将主分支推送到我们的“origin”服务器。

Once that is done, you will be able to browse your newly-committed content via gitweb, clone the repository via either read-only or read/write access methods, push more check-ins, etc. 完成后,您将能够通过gitweb浏览新提交的内容,通过只读或读/写访问方法克隆存储库,推送更多签到等。

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

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