1

out of the blue, after having commited changes to my local depository countless times in the past, Xcode is not allowing me to commit with the following error message:

The working copy “MYAPPNAME” failed to commit files.

*** 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 'myuserid@mycomputername.(none)')

I see that you can set the email address in the command line but I'm wondering what could have caused this error to suddenly appear. Also, since I am in the habit of pushing changes to a remote repo, I'm wondering if any changes I make now on my Mac will create problems syncing to that repo.

Thanks in advance for any suggestions on what might have caused this error to suddenly occur and the safest approach to dealing with it.

user6631314
  • 1,751
  • 1
  • 13
  • 44

2 Answers2

1

As I mentioned here, that means your global settings no longer includes user.name/user.email.

That does not affect your past commits (which have been pushed): only the ones, that Git does not want to create as long as you haven't entered again your name/email.

Check the result of git config -l --show-origin: one of those file must have changed recently.
Typically:

  • ~/.gitconfig file, or:
  • $XDG_CONFIG_HOME/git/config

If the environment variable $XDG_CONFIG_HOME has been reset, that might explain why this error message suddenly appears.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I marked VonC's answer correct as it gave way to check status of your files. However, in my case, the error occurred when I was trying to commit changes in France and has disappeared upon return to US. So ultimately not sure what caused it. – user6631314 Jul 30 '18 at 16:32
  • @user6631314 Crossing the French border with your computer did not magically change the `.gitconfig` file on that computer, I assure you. — Or are you saying you were using someone else's computer? In that case, that's the reason. Your `.gitconfig` file is obviously not present on someone else's computer. – matt Jul 30 '18 at 16:38
  • @user6631314 "I marked VonC's answer correct": that was the right call... I don't see it marked now. – VonC Jul 30 '18 at 19:21
1

This has nothing to do with your username and password for pushing and fetching to a remote.

It’s just a question of the identifying info that git associates with every commit. Without a name and email, you can’t create a commit.

Just do what the message requests and all will be well.

matt
  • 515,959
  • 87
  • 875
  • 1,141