gitgit-config

How to know the git username and email saved during configuration?


While configuring git I ran these two commands:

git config --global user.name "My Name"

git config --global user.email "myemail@example.com"

However, I doubt whether I made a typo or not. So, is there any command to know the name and email which git saved during configuration? Obviously, I can know that using the git log command by looking at the commit history. But for that I have to make commits, right? Can I know that with the help of command line?


Solution

  • Considering what @Robert said, I tried to play around with the config command and it seems that there is a direct way to know both the name and email.

    To know the username, type:

    git config user.name
    

    To know the email, type:

    git config user.email
    

    These two output just the name and email respectively and one doesn't need to look through the whole list. Comes in handy.