1

When I try to commit to a local git, it keeps asking me to set up a user.mail and user.name, despite them being setup correctly both locally and globally.

I seem to have the same problem as this post.
The solution proposed (setting url = "https://username@website.com/git_name" in .git/config) is both not working and not satisfying (I want to keep using SSH).

Is this a bug ?
I am running git version 2.32.1 (Apple Git-133) on a new Macbook Pro with a M1 Pro cpu.
Both my windows and WSL installation have no problem like this whatsoever.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Magyar_57
  • 25
  • 7
  • 3
    Your `user.name` and `user.email` settings have nothing to do with authentication (and so nothing to do with the url). It sounds like you haven't set `user.name` and `user.email` globally in your git configuration. Git should be providing you with instructions on how to do that. – larsks Sep 04 '22 at 22:15

1 Answers1

0

First, the solution I mentioned was for an HTTPS URL, not an SSH one.

Meaning url = "https://username@website.com/git_name", not url = "username@website.com/git_name".

Second, if you get an error on git commit, it has nothing to do with the git remote origin URL.

Check what is configured with:

git config -l --show-origin --show-scope

The OP Magyar_57 mentions in the comments:

 global file:/Users/me/.gitconfig user.name=myusername 
 global file:/Users/me/.gitconfig user.mail=mymail@mail.com

That is the error:
You need to set email, not mail:

git config --global user.email mymail@mail.com
                        ^^^
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I corrected the url mistake in my post. I checked what you asked me to and I got: ``` me@pc ~ % git config -l --show-origin --show-scope unknown file:/Applications/Xcode.app/Contents/Developer/usr/share/git-core/gitconfig credential.helper=osxkeychain global file:/Users/me/.gitconfig user.name=myusername global file:/Users/me/.gitconfig user.mail=mymail@mail.com ``` I dont understand what Xcode have to do with github configuration here, but I guess it might be causing some issues – Magyar_57 Sep 05 '22 at 10:32
  • @Magyar_57 I have edited the answer to address your configuration error. – VonC Sep 05 '22 at 12:08