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

Time:09-06

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://[email protected]/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.

CodePudding user response:

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

Meaning url = "https://[email protected]/git_name", not url = "[email protected]/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 [email protected]

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

git config --global user.email [email protected]
                        ^^^
  •  Tags:  
  • git
  • Related