简体   繁体   中英

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM