Git keeps asking for my user.name and user.mail despite global storage (ssh key)

Viewed 55

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.

1 Answers

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
                        ^^^
Related