How to Change Your Git Username (Locally or Globally)

Whether you’re switching accounts, updating your display name, or just fixing a typo, changing your Git username is quick and easy. In this blog, you’ll learn how to change your Git username locally (per project) or globally (for all Git repositories) on your system.

Let’s dive in.


✅ What Does “Git Username” Mean?

When you make a commit in Git, it records two key pieces of identity information:

  • Username (your name)
  • Email address

This information appears in the commit history and helps identify who made each change.


🛠 How to Change Git Username

🌐 1. Change Git Username Globally

To change your username for all repositories on your computer:

git config --global user.name "Your New Name"

To verify it worked:

git config --global user.name

✅ This will update your name for all future commits across all repositories on your machine.


📁 2. Change Git Username Locally (Per Project)

To change your username for a specific repository only:

  1. Navigate to your project directory:
cd path/to/your/project
  1. Run:
git config user.name "Your New Name"
  1. Verify:
git config user.name

✅ This affects only that specific repository and overrides the global setting.


📧 Bonus: Change Git Email

Often, your username is linked to an email address (especially when pushing to GitHub).

To update your Git email:

git config --global user.email "yo*@ex*****.com"

Or locally:

git config user.email "yo*@ex*****.com"

🧠 Check Current Git Config

To view your Git identity settings:

git config --list

You’ll see something like:

user.name=John Doe
user.email=jo*****@ex*****.com

🐙 Changing Your Username on GitHub.com

If you want to change the username that appears on GitHub (the website):

  1. Go to your GitHub profile
  2. Click your avatar → Settings
  3. Under “Profile”, edit your username
  4. Save changes

🔔 Be cautious: Changing your GitHub username may break links to repositories or gists you’ve shared.


🔄 Recap

ActionCommand
Change username globallygit config --global user.name "New Name"
Change username locallygit config user.name "New Name"
Change email globallygit config --global user.email "yo*@ex*****.com"
Check settingsgit config --list

🚀 Final Thoughts

Your Git identity is how your contributions are tracked and recognized. Keeping it accurate—especially when working across multiple accounts or teams—is essential for clarity and collaboration.

Whether you’re working solo or contributing to open source, a quick git config can keep your name (and reputation) in order.

Sharing Is Caring:

Leave a Comment