Skip to content
Author: ytianle

Check User and Email⚓︎

This guide helps you check your Git user email and other configurations.

Local Git User-email check⚓︎

You can check the user name and email configurations of your current Git repository, global Git configurations, or system Git configurations by running the following command:

terminal
git config --local/--global/--system user.email
git config --local/--global/--system user.name

#>>> Your Name
#>>> your.email@example.com

Update Git User-email⚓︎

You can setup or update your Git user and email by following below steps:

  1. Set up system user name and email (optional, usually requires admin access):
    terminal
    git config --system user.name "New Name"
    git config --system user.email "new.email@example.com"
    
  2. Set up global user name and email (recommended for most users):
    terminal
    git config --global user.name "New Name"
    git config --global user.email "new.email@example.com"
    
  3. Set up local user name and email for repository specific override:
    terminal
    git config --local user.name "New Name"
    git config --local user.email "new.email@example.com"
    
  4. Rewrite the last commit author info and update the remote (only if you already committed/pushed with the wrong identity).
    terminal
    git commit --amend --reset-author --no-edit
    git push --force-with-lease
    
    Note that this will rewrite history, so use with caution if you have collaborators.