Friday, April 15, 2022

[SOLVED] Git Commit asks for credentials instead of SSH in WSL2

Issue

Everything else seems to work okay with the SSH keys, but when I do:

git commit -m "message"

It gives me this:

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  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: empty ident name (for <COMPUTER_NAME>) not allowed

Like I said, everything else, git add, git push, git pull works as intended (Git push/pull asks for SSH authentication) except for commit.

I have checked the .git/config file to make sure it was setup for SSH and in fact it was.


Solution

This isn't a prompt for credentials. When you make a commit, Git needs to know the name (that is, a personal name, not a username) and the email address to embed in the commit. This data has absolutely nothing to do with authenticating, but is merely required for the commit to be created by Git. Once you've committed, you can see this data with git log.

You should specify your personal name and email address as directed and then the commit can succeed.



Answered By - bk2204
Answer Checked By - Marie Seifert (WPSolving Admin)