Xcode 和 Git 源代码管理:“工作副本 XXXXX 提交文件失败”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14694662/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 04:43:21  来源:igfitidea点击:

Xcode and Git Source Control : “The working copy XXXXX failed to commit files”

iphonexcodegit

提问by JSWilson

I have been using Xcode to develop and publish apps for almost a year. I have been using git as the local repository and bitbucket as the remote repository. Everything has been going fine until this morning. I am now getting an error 'The working copy "xxx" failed to commit files. Please tell me who you are.'Xcode then suggests that I run git config and give it an email address and name. I have no idea why it suddenly needs to know who I am. I don't know who it thought I was before and I don't want it to become more confused than it is now. I have not done anything with command prompts on the Mac so I am not sure where it expects me to enter this information. I vaguely recalled seeing suggestions on using the command prompt to set up bitbucket a year ago but they looked confusing so I did everything from the xcode GUI. Is this something new in xcode 4.6? What do I do?

近一年来,我一直在使用 Xcode 开发和发布应用程序。我一直使用 git 作为本地存储库,使用 bitbucket 作为远程存储库。一切都很顺利,直到今天早上。我现在收到错误消息“工作副本“xxx”无法提交文件。请告诉我你是谁。然后 Xcode 建议我运行 git config 并给它一个电子邮件地址和名称。我不知道为什么它突然需要知道我是谁。我不知道它以前以为我是谁,我不希望它变得比现在更加困惑。我没有在 Mac 上使用命令提示符做任何事情,所以我不确定它希望我在哪里输入这些信息。我依稀记得一年前看到有关使用命令提示符设置 bitbucket 的建议,但它们看起来令人困惑,所以我从 xcode GUI 完成了所有操作。这是 xcode 4.6 中的新东西吗?我该怎么办?

回答by Kenneth Vittetoe

I was getting this also. at first I could restart the mac and everything was working fine. Eventually though the problem came back with a vengeance even with a restart it would not let me commit so I had to do the command line loving. one caveat being that you have to type xcrun before any git commands in terminal when using vanilla git installed with Xcode.

我也得到了这个。起初我可以重新启动 mac,一切正常。最终,尽管即使重新启动,问题也卷土重来,但它不会让我提交,所以我不得不喜欢命令行。一个警告是,当使用与 Xcode 一起安装的 vanilla git 时,您必须在终端中的任何 git 命令之前键入 xcrun。

so type:

所以输入:

xcrun git config --global user.email [email protected]
xcrun git config --global user.name "your name"

after doing this everything was fine and dandy.

这样做之后,一切都很好。

回答by TonioGA

I faced the same issue after installing Xcode 7. The solution provided by Kent Latimer worked for me. Config without --global in workspace directory from terminal.

安装 Xcode 7 后我遇到了同样的问题。 Kent Latimer 提供的解决方案对我有用。在终端的工作区目录中没有 --global 的配置。

xcrun git config user.name "Toto"
xcrun git config user.email [email protected]

回答by Plexander

A file being Committed can cause the error:

正在提交的文件可能会导致错误:

The working copy '' failed to commit files. Couldn't communicate with a helper application

工作副本 '' 未能提交文件。无法与辅助应用程序通信

For those using Xcode for Source Control, and who have tried with no success:

对于那些使用 Xcode 进行源代码管理并且尝试过但没有成功的人:

xcrun git config --global user.name "Toto" and
xcrun git config --global user.email [email protected]

xcrun git config --global user.name "Toto"
xcrun git config --global user.email [email protected]

Check to see if a file being Committed is causing this problem.

检查是否正在提交的文件导致此问题。

Here's how to navigate through this error:When committing, uncheck one file at a time and try Committing. If that doesn't work, uncheck multiple files and only leave a few or one checked.

以下是解决此错误的方法:提交时,一次取消选中一个文件并尝试提交。如果这不起作用,请取消选中多个文件,只选中几个或一个。

What to expect:Eventually, you should figure out which file is preventing the communications with the git. Once all the other files are Committed, disregard all changes. Everything should work fine after this.

预期结果:最终,您应该找出哪个文件阻止了与 git 的通信。提交所有其他文件后,忽略所有更改。在此之后一切都应该正常工作。

How might files change without being tracked?A file changed without being tracked by Source Control will cause this problem. This could happen if perhaps you had to switch MacBooks to a backup so you could send off your primary MacBook for repair. Using Dropbox to sync up your files works, for the most part, but the original Xcode may make a subtle change that was not tracked in the MacBook the project is being migrated to.

文件如何更改而不被跟踪?未经源代码管理跟踪而更改的文件将导致此问题。如果您必须将 MacBook 切换到备份,以便将您的主要 MacBook 送去维修,则可能会发生这种情况。在大多数情况下,使用 Dropbox 同步您的文件是有效的,但原始 Xcode 可能会进行细微的更改,而该更改在项目迁移到的 MacBook 中未进行跟踪。

回答by zevij

An alternative: Assuming you have actually configured git to work with xcode and assuming it is just xcode playing up, you can try this as an alternative in xcode when your project is open:

另一种选择:假设您实际上已将 git 配置为使用 xcode 并假设它只是 xcode 播放,您可以在项目打开时尝试将其作为 xcode 中的替代方法:

Source Control -> Configure -> click "ok"

源代码管理 -> 配置 -> 点击“确定”

This seem to refresh the config you set up initially.

这似乎刷新了您最初设置的配置。

回答by Nostradamus

In case none of the above solutions worked, wanted to mention that in my case I got this error when dragging some libraries into my svn project which were from github and under some kind of GIT control.

如果上述解决方案都不起作用,我想提一下,在我的情况下,将一些库拖到我的 svn 项目中时出现此错误,这些库来自 github 并受某种 GIT 控制。