The fastest way to see your Git username

Open your terminal and type git config user.name, then press Enter. The terminal will print the username you have set for Git on your computer. If nothing prints, you have not yet set a username — Git will not have one to show you.

This command reads the configuration file Git uses to tag your commits. Every commit you make gets marked with this username, so it is the name that appears in your project history and on platforms like GitHub or GitLab.

If you want to see both your username and email at once, type git config user.name and git config user.email as two separate commands, or use git config --list to see all your Git settings in one view.

Key Takeaways

  • Type git config user.name in terminal to see the username Git will use for your commits.
  • If the command returns nothing, you have not set a Git username yet and will need to create one before committing.
  • Use git config --list to view all your Git settings, including username, email, and other configuration options.
  • The username shown is the one stored on your computer — it may differ from your GitHub or GitLab account name.

Understanding local versus global Git usernames

Git lets you set a username in two ways: local (for one project folder) or global (for all projects on your computer). The command git config user.name shows your local setting if you are inside a project folder, or your global setting if you are not.

If you have set different usernames for different projects, you need to be in the right folder to see the local one. Type git config --local user.name to force Git to show only the local setting for that folder, or git config --global user.name to see the global one you use everywhere.

What to do if Git shows no username

If the terminal prints nothing when you type git config user.name, Git does not have a username set yet. You will need to create one before you can commit code. Set a global username by typing git config --global user.name "Your Name", replacing "Your Name" with the name you want to appear in your commit history.

You can use any name — it does not have to match your GitHub username or your real name. Many developers use a short version of their name, a nickname, or a handle. Once you set it, every commit you make will carry that name forward.

Checking your username on different platforms

Your Git terminal username is separate from your GitHub, GitLab, or Bitbucket account name. You might have a Git username of "alice" but a GitHub username of "alice-dev". When you push code to GitHub, Git uses your account credentials to authenticate, but the commits themselves are tagged with your Git username.

To see what name appears on your commits after you push them, go to your repository on GitHub or GitLab and look at the commit history. The author name shown there is your Git username, not your account name. If you want them to match, you can change your Git username to match your platform account name.

Changing your Git username if needed

If you want a different username, type git config --global user.name "New Name" to change your global setting. This affects all future commits on your computer. If you only want to change the username for one project, navigate into that project folder and type git config --local user.name "New Name" instead.

Changing your username does not alter commits you have already made — those keep the old name. Only new commits will use the new username. If you need to change the author name on past commits, that requires rewriting your commit history, which is more complex and should only be done if you have not yet pushed those commits to a shared repository.

Why Git needs your username

Git records a username and email with every commit so that anyone reading the project history knows who made each change. This is useful for tracking who wrote what code, finding the person to ask about a change, and maintaining a clear record of your project's development.

On platforms like GitHub, the email you set in Git is matched against your account email to link your commits to your profile. If your Git email does not match any email on your GitHub account, the commits will still appear in the history, but they will not be linked to your profile picture or account.

Frequently Asked Questions

Can I have different Git usernames for different projects?

Yes. Use git config --local user.name "Name" inside a project folder to set a username just for that project. This overrides your global username for that folder only. All other projects will still use your global username.

Does my Git username have to match my GitHub username?

No. Your Git username is what appears in your commit history. Your GitHub username is your account name on the platform. They can be different. However, your Git email should match an email on your GitHub account for commits to link to your profile.

What if I see a different username than the one I set?

You may be in a project folder with a local username set, which overrides your global one. Type git config --local user.name to check. If a local username exists, that is what Git will use for commits in that folder.

Can I see the username for a commit someone else made?

Yes. Type git log to see all commits in your project with their authors. Type git log --oneline for a shorter view, or git show [commit-hash] to see details of a specific commit, including who made it.