7

With Xcode 7, I'm having a problem committing code to 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)')

I've tried the git commands suggested; when I run git config user.email in the repository I see a correct email address. I don't see where it's pulling the incorrect one from.

stevex
  • 5,589
  • 37
  • 52
  • Even creating a new project exhibits this behaviour, and "git config --global user.email" shows a valid email address. – stevex Sep 10 '15 at 12:39
  • See also http://stackoverflow.com/questions/32544188/xcode-7-gm-cant-commit-git – Jeff Oct 10 '15 at 13:56

2 Answers2

8

Like most people, I expect, I had the correct global setting of user.email and user.name and never had problems with Xcode before.

I found that by making those settings local Xcode was happy again.

That is:

cd <YourCodeRepository>
xcrun git config user.email "you@example.com"
xcrun git config user.name "Your Name"
MichaelR
  • 1,681
  • 15
  • 28
  • Having an incorrect local config that's different from the global config is one possible problem, but unfortunately it's not the problem I'm having. A brand new Xcode project, in a new repository, gives the same message. – stevex Sep 12 '15 at 11:37
  • That is really weird. I had a correct config, but the mail and name settings were not in the local config. The Xcode 7 release notes say 'The Xcode build system no longer automatically inherits the environment used to launch the app when running in the IDE.' So that gives a possible cause. I traced the system calls made by Xcode 7 and found it will open the .git directory for the current project (only). I suspect Xcode is simply checking the local project .git directory for the settings. But unfortunately that doesn't explain your issue. – MichaelR Sep 12 '15 at 21:32
  • I can confirm that a brand new Xcode project requires the email and name settings. Steps: 1. Create Project. 2. cd 3. git init 4. Set (local) user.email and user.name. Xcode is ignoring the global settings (despite the message). – MichaelR Sep 13 '15 at 00:40
  • Well turns out you're right. Even though, when I'd query the local setting it would give the correct value, explicitly setting it to the same value did fix it. Thanks! – stevex Sep 13 '15 at 01:55
0

You're not the only one. There is even a special topci on apple forums. I also tried by renaming global settings - nothing helped. Try using:

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

but sadly for me it didn't work. I think they will fix this after official release. Until then, You must use Terminal, Source Tree or other tools.

tomqz
  • 3
  • 8