【问题标题】:Xcode git Auto-Detect Email ErrorXcode git 自动检测电子邮件错误
【发布时间】:2015-12-06 14:33:34
【问题描述】:

使用 Xcode 7,我在将代码提交到 git 时遇到问题。

I get this error:

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'stevex@stevebookpro.(none)')

我已经尝试了建议的 git 命令;当我在存储库中运行 git config user.email 时,我看到了一个正确的电子邮件地址。我看不出它从哪里拉出不正确的。

【问题讨论】:

标签: xcode git


【解决方案1】:

你不是唯一一个。 appleforums 上甚至还有一个特殊的 Topci。我还尝试通过重命名全局设置 - 没有任何帮助。尝试使用:

xcrun git config --global user.email "you@example.com"
xcrun git config --global user.name "Your Name"

但对我来说遗憾的是它没有用。我想他们会在正式发布后解决这个问题。在此之前,您必须使用终端、源代码树或其他工具。

【讨论】:

    【解决方案2】:

    我希望像大多数人一样,我有正确的 global user.email 和 user.name 设置,并且以前从未遇到过 Xcode 问题。

    我发现通过本地进行这些设置,Xcode 又开心了。

    即:

    cd <YourCodeRepository>
    xcrun git config user.email "you@example.com"
    xcrun git config user.name "Your Name"
    

    【讨论】:

    • 有一个与全局配置不同的不正确的本地配置是一个可能的问题,但不幸的是这不是我遇到的问题。一个全新的 Xcode 项目,在一个新的存储库中,给出了相同的信息。
    • 这真的很奇怪。我有一个正确的配置,但邮件和名称设置不在本地配置中。 Xcode 7 发行说明说“在 IDE 中运行时,Xcode 构建系统不再自动继承用于启动应用程序的环境。”所以这给出了一个可能的原因。我跟踪了 Xcode 7 进行的系统调用,发现它将打开当前项目的 .git 目录(仅)。我怀疑 Xcode 只是检查本地项目 .git 目录的设置。但不幸的是,这并不能解释您的问题。
    • 我可以确认一个全新的 Xcode 项目需要电子邮件和名称设置。步骤: 1. 创建项目。 2. cd 3. git init 4. 设置(本地)user.email 和 user.name。 Xcode 忽略了全局设置(尽管有消息)。
    • 事实证明你是对的。即使,当我查询本地设置时,它会给出正确的值,但明确地将其设置为相同的值确实可以解决它。谢谢!
    猜你喜欢
    • 1970-01-01
    • 2014-10-29
    • 1970-01-01
    • 2010-11-04
    • 2017-01-07
    • 1970-01-01
    • 1970-01-01
    • 2020-09-21
    • 2011-09-05
    相关资源
    最近更新 更多