如何在Xcode中配置Git以与BitBucket一起使用

如何在Xcode中配置Git以与BitBucket一起使用

本文介绍了如何在Xcode中配置Git以与BitBucket一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目已经有很长的历史了,并且没有与任何源代码存储库连接.

I have a project which I have been on for ages which is not connected to any source code repository.

我现在想开始使用BitBucket,但是我不确定该怎么做.我已经在BitBucket中创建了一个项目.

I want to start using BitBucket now, however I am not sure how to go about it. I have created a project in BitBucket.

现在应该克隆并在Xcode中签出,还是应该在xcode中添加存储库.有人有什么主意吗?

Should I now clone and check out in Xcode or should I add a repository in xcode. Anyone have any idea?

我尝试使用bitbucket中的URL进行克隆,但它只是Xcode中的错误而返回

I have tried cloning using the URL from bitbucket but it just comes back with an error in Xcode

推荐答案

自2017年起,xCode现在自动为新项目创建存储库.要推送到新的BitBucket存储库,请在xCode中转到源代码管理">提交...",然后进行首次本地提交.

As of 2017, xCode now automatically creates repositories for new projects. To push to a new BitBucket repo, go to 'Source Control' > 'Commit...' in xCode and make your first local commit.

接下来,打开一个终端并导航到项目的顶级目录.如果您在此处ls -a,则应该看到.git/目录已创建.在同一目录中,添加以下远程仓库(用您的用户名/团队名称和仓库名称代替):

Next open a terminal and navigate to to the top-level directory of your project. If you ls -a in here you should see the .git/ directory has been created. In the same directory, add your remote repo with the following (replace with your username/team name and repo name):

git remote add origin https://[email protected]/USERNAME/REPO_NAME.git

返回到xCode,转到源代码控制">推...".系统将提示您输入BitBucket密码.按确定,您就完成了!源代码控制命令现在将在xCode中运行.

Go back into xCode, go to 'Source Control' > 'Push...'. You'll be prompted to enter your BitBucket password. Press OK and you're done! Source control commands will now be working within xCode.

这篇关于如何在Xcode中配置Git以与BitBucket一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 19:59