Xcode 4.0.2 Git 提交错误:致命:'...' 在存储库之外(可能的错误)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6377684/
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
Xcode 4.0.2 Git Commit Error: fatal: '...' is outside repository (Possible Bug)
提问by ObjectiveTC
This is an issue in XCode in which the built-in source control feature is unable to load the repository for projects located within a directory named with ALL-CAPS, such as ~/Documents/CODE
. Running XCode 4.0.2 on a 2008 black macbook. If anyone has insight, please share.
这是 XCode 中的一个问题,其中内置的源代码控制功能无法加载位于以 ALL-CAPS 命名的目录中的项目的存储库,例如~/Documents/CODE
. 在 2008 年黑色 macbook 上运行 XCode 4.0.2。 如果有人有见解,请分享。
This was the issue.I create a new project, save it to the directory ~/Documents/CODE/...
here-or-a-subdirectory-therein, making sure to check the "create local git repository" checkbox. I make a small edit to the AppDelegate or any other file, and Source Control commits will not work from within XCode. From the command-line, I see that .git was created in the project directory, and that the 'first commit' occurred. I can perform git commits from the command-line.
这就是问题所在。我创建了一个新项目,将其保存到目录~/Documents/CODE/...
here-or-a-subdirectory-thein 中,确保选中“创建本地 git 存储库”复选框。我对 AppDelegate 或任何其他文件进行了小的编辑,并且源代码管理提交在 XCode 中不起作用。从命令行,我看到 .git 是在项目目录中创建的,并且发生了“第一次提交”。我可以从命令行执行 git commits。
Possibly related issue:In Organizer->repositories
, all my repositories have the yellow stoplight icon (even those I've gotten to work).
可能相关的问题:在 中Organizer->repositories
,我所有的存储库都有黄色的红绿灯图标(即使是那些我已经开始工作的)。
This was the Error:When I try to commit from the project window (File-->SourceControl-->Commit
, type a comment, and press commit) I get the following error:
这是错误:当我尝试从项目窗口(File-->SourceControl-->Commit
,键入注释,然后按提交)提交时,出现以下错误:
The Working copy of "MyProjectName" failed to commit files. fatal: '/Users/myUserName/Documents/CODE/MyProjectName/MyProjectName/MyProjectNameAppDelegate.m' is outside repository.
“MyProjectName”的工作副本提交文件失败。致命:'/Users/myUserName/Documents/CODE/MyProjectName/MyProjectName/MyProjectNameAppDelegate.m' 在存储库之外。
Over in the Organizer, I select MyProjectName (with the drop-down arrow and icon of the repository safe). The location is displayed as /Users/myUserName/Documents/CODE/MyProjectName/
But in the area where the commit comments are normally displayed, I see the message:
在管理器中,我选择 MyProjectName(带有存储库安全的下拉箭头和图标)。位置显示为/Users/myUserName/Documents/CODE/MyProjectName/
But 在正常显示提交注释的区域,我看到消息:
Unable to load revisions.
无法加载修订。
The likely cause was that XCode was internally identifying the Project directory as ~/Documents/Code
, not ~/Documents/CODE
.
可能的原因是 XCode 在内部将项目目录标识为~/Documents/Code
,而不是~/Documents/CODE
。
One way to resolve the issuewas to rename ~/Documents/CODE
to ~/Documents/Code
, then in Organizer (select the Repositories Tab) I deleted the repository listing for MyProjectName.
解决该问题的一种方法是重命名~/Documents/CODE
为~/Documents/Code
,然后在管理器中(选择存储库选项卡)我删除了 MyProjectName 的存储库列表。
NOTE - Only removes XCode's reference to the repository, the actual repository remains intact. Now Close XCode and Reopen it. Open the project MyProjectName. XCode will recreate a reference to the Project with the correct Capitalization. Note that the renaming of the directory seems to force XCode to recognize the new directory name when the repository is recreated.
注意 - 仅删除 XCode 对存储库的引用,实际存储库保持不变。现在关闭 XCode 并重新打开它。打开项目 MyProjectName。XCode 将使用正确的大写重新创建对项目的引用。请注意,目录的重命名似乎迫使 XCode 在重新创建存储库时识别新目录名称。
Another way to resolve the issue is:within XCode's Organizer window (select the Repositories Tab), delete the reference to the repository. Then, still in Organizer, select the "Projects" tab at top. To the left of the project's window is a list of all the projects...select MyProjectName. Now in the center frame is a field named "Derived Data" with a path to your project. Click the little -> arrow to the right of the PATH to open up the Project's Internal Settings Directory in Finder. Open the file called "info.plist" and edit the key "WorkspacePath" such that it's value EXACTLY MATCHES the location of your project (correct the capitalization of the directory if necessary). Save, and return to Organizer. Close XCode. Reopen XCode and the repository reference will be recreated. You can go directly into Organizer now, select the "Repositories" tab, then select MyProjectName's repository. You'll see the commit messages there (even if you haven't committed yet, you'll still see the auto-generated 'first-commit' that occurred internally when your project was created).
解决问题的另一种方法是:在 XCode 的管理器窗口中(选择存储库选项卡),删除对存储库的引用。然后,仍然在管理器中,选择顶部的“项目”选项卡。项目窗口的左侧是所有项目的列表...选择 MyProjectName。现在在中心框架中是一个名为“派生数据”的字段,其中包含项目的路径。单击 PATH 右侧的小 -> 箭头以在 Finder 中打开项目的内部设置目录。打开名为“info.plist”的文件并编辑键“WorkspacePath”,使其值与您的项目位置完全匹配(如有必要,更正目录的大小写)。保存并返回到 Organizer。关闭 XCode。重新打开 XCode,将重新创建存储库引用。您现在可以直接进入 Organizer,选择“存储库”选项卡,然后选择 MyProjectName 的存储库。您将在那里看到提交消息(即使您尚未提交,您仍会看到创建项目时在内部发生的自动生成的“首次提交”)。
回答by Chris
I just ran into this problem. Luckily, restarting Xcode did the trick for me.
我刚刚遇到了这个问题。幸运的是,重新启动 Xcode 对我有用。
回答by Igor Leonovich
I had the same issue. You must to remove this problem file from project (only reference) and then return it back.
我遇到过同样的问题。您必须从项目中删除此问题文件(仅供参考),然后将其返回。
回答by edo42
Happened to me that the little checkboxes next to the files in the commit window were all deselected. I selected them and this error came out.
Restarted XCode and it was the same but I noticed that the Commit button was enabled although the files were still deselect.
Tried it and it was successful...
Sometimes XCode is so strange
发生在我身上,提交窗口中文件旁边的小复选框都被取消了。我选择了它们,然后出现了这个错误。
重新启动 XCode,它是一样的,但我注意到尽管文件仍然取消选择,但提交按钮已启用。
试了一下,成功了。。。
有时候XCode就是这么奇怪
回答by pmau
You should probably consider using i case sensitive HFS Volume for your source files. This way you avoid name clashes like the ones you see.
您可能应该考虑对源文件使用 i 区分大小写的 HFS 卷。这样您就可以避免像您看到的那样的名称冲突。
You could try and create a disk image using a case sensitive filesystem and see if your problem persists.
您可以尝试使用区分大小写的文件系统创建磁盘映像,然后查看问题是否仍然存在。
回答by Josip B.
I had similar problem and the problem in hidden .git folder. I added external class which I cloned from git repository and when I was adding files to my XCode project I accidentally added hidden .git files. When I removed them everything started working correctly.
我有类似的问题和隐藏的 .git 文件夹中的问题。我添加了从 git 存储库克隆的外部类,当我向 XCode 项目添加文件时,我不小心添加了隐藏的 .git 文件。当我删除它们时,一切都开始正常工作。