将 SCM 添加到 Xcode 项目但遇到身份验证问题 [英] Add SCM to an Xcode project but meet an authentication issue

查看:27
本文介绍了将 SCM 添加到 Xcode 项目但遇到身份验证问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况是,我在创建项目时忘记在 Xcode 中选择使用源代码管理".然后我发现在没有选择源代码控制的情况下我无法更新任何东西,但也找不到可以将 SCM 添加到我已经创建的项目的位置.重新创建一个新项目是一个愚蠢的想法,所以如果有人在 PLZ 之前遇到过同样的问题,请伸出援手 :)

The situation is, I forgot to choose "use source control" in Xcode when creating my project. Then I found I can't update anything without source control selected, but also can't find where can add SCM to the project I've already created. Re-create a new project is a stupid idea, so if anyone met the same issue before PLZ gimme a hand :)

更新 1:

我尝试使用命令行来设置 git 存储库并且成功了.但是仅仅将 git 添加到项目是不够的,您必须将它作为存储库添加到组织器中,以便 Xcode 可以找到检出或更新代码的位置.然后我又遇到了另一个问题:

I tried command line to set up git repository and it succeeded. But just add git to project is not enough, you have to add it to the oragnizer as a repository so Xcode can find where to check out or update your code. Then I encountered another issue:

在 Xcode 4 用户指南中它说:

In Xcode 4 user guide it says:

通过抽象常见的存储库操作,Xcode 支持 Git 和 Subversion (SVN) 存储库,具有单一、统一的图形用户界面和工作流程.根据您的选择,这一操作会检出(对于 SVN)或克隆(对于 Git)存储库并将其与您的项目集成.

By abstracting common repository operations, Xcode supports both Git and Subversion (SVN) repositories with a single, unified graphical user interface and workflow. Depending on your choice, this one operation checks out (for SVN) or clones (for Git) the repository and integrates it with your project.

在 Xcode 中克隆 Git 存储库会在您的本地系统上设置一个完整的存储库,并将该存储库与您的工作区集成,以便您可以快速开始使用它.这种方法为您提供分布式版本控制的好处,包括完全提交权限,无论您是否在线.

Cloning a Git repository in Xcode sets up a complete repository on your local system and integrates that repository with your workspace so that you can quickly start using it. This approach gives you the benefits of distributed version control, including full commit rights, whether you’re online or not.

它还提供了几个步骤:

在存储库管理器中,单击添加按钮并选择检出或克隆存储库.

In the repositories organizer, click the Add button and choose Checkout or Clone Repository.

输入文件的路径名或 URL.

Enter the pathname or URL for the file.

当主机可访问"指示器变为绿色时,单击下一步按钮.

When the "Host is reachable" indicator turns green, click the Next button.

输入存储库的本地名称,然后单击克隆(或检出)进行复制.

Enter a local name for the repository and click Clone (or Checkout) to copy it.

选择一个位置并单击突出显示的克隆(或结帐)按钮以保存本地存储库.

Choose a location and click the highlighted Clone (or Checkout) button to save the local repository.

当我进入第 3 步时,出现黄色指示灯而不是绿色指示灯并显示需要身份验证".

When I went to step 3, a yellow lamp occurred instead of a green one and said "authentication required".

我点击了下一步按钮,但克隆失败.然后它什么也没显示,没有错误日志或通知或其他任何东西.

I clicked next button, and clone failed. Then it showed NOTHING, no error log or notice or anything else.

当我单击上一个按钮时,它也没有显示任何内容,所以我认为这是 Xcode 版本 4.3.2 (4E2002) 的一个错误.

When I clicked previous button it also showed nothing, so I think it's a bug of Xcode Version 4.3.2 (4E2002).

新手好像不能发图片...链接如下:T_Thttp://i.stack.imgur.com/jWXvx.png

Seems newbie can't post image... link below: T_T http://i.stack.imgur.com/jWXvx.png

http://i.stack.imgur.com/K6MqG.png

更新 2:

此外,我还尝试了添加存储库"而不是签出或克隆存储库".它再次给了我同样的通知,但不久之后我看到了一盏绿灯.不幸的是,屏幕中央显示无法加载修订版"的标签,似乎仍然无法正常工作.

Besides, I also tried "Add repository" instead of "Checkout or Clone Repository". It gave me the same notice again, but after a short while I saw a green lamp. Unfortunately a label said "Unable to load revisions" showed at center of screen, and seems it still can't work.

我用谷歌搜索这些问题,但找不到任何有价值的答案.

I googled for these issues but can't find any valuable answer.

更新 3:我尝试重新启动我的 MAC 和 Xcode,然后这个问题自己解决了......它非常复杂......

Update 3: I tried to restart my MAC and Xcode, then this problem fixed itself... it's very complicated...

推荐答案

如果你想使用 git 作为你的版本控制系统,那么去终端上你的项目文件夹并运行这些命令 -

If you want to use git as your version control system then go to your project folder on terminal and run these commands -

git init

git add .

git commit -m "Initial commit"

或者如果你想使用 SVN 作为你的版本控制系统,那么按照这个

Or if you want to use SVN as your version control system then follow this

1) 使用 mkdir 命令创建一个目录,该目录包含三个名为分支、标签和主干的子目录,用于保存项目的临时副本.
2) 将您的 Xcode 项目复制到 trunk 子目录中.
3) 使用 svnadmin create 命令创建一个空的 Subversion 存储库.
4) 使用 svn import 命令将您的项目导入到新的 Subversion 存储库中.

1) Use the mkdir command to create a directory with three subdirectories named branches, tags, and trunk to hold a temporary copy of your project.
2) Copy your Xcode project into the trunk subdirectory.
3) Use the svnadmin create command to create an empty Subversion repository.
4) Use the svn import command to import your project into the new Subversion repository.

示例 -

  mkdir /Repo_Master/Sketch_svn_tmp/trunk
  mkdir /Repo_Master/Sketch_svn_tmp/branches
  mkdir /Repo_Master/Sketch_svn_tmp/tags
  cp -R /Library/MyProjects/Sketch /Repo_Master/Sketch_svn_tmp/trunk
  svnadmin create /Repo_Master/Sketch_svn
  svn import /Users/myUserName/Projects/Sketch_tmp \
  file:///Users/myUserName/Repositories/Sketch_svn -m "Initial import"

这篇关于将 SCM 添加到 Xcode 项目但遇到身份验证问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆