The fastest way to check your Git username

Open the terminal in VS Code by pressing Ctrl+` (backtick) on Windows or Linux, or Cmd+` on Mac. Then type this command and press Enter:

git config user.name

The terminal will print your Git username on the next line. This shows the name you have set for the current repository. If nothing prints, your username is not yet configured for this folder — you will need to set it first before making commits.

If you want to see both your username and email at once, type git config --list instead. This shows all your Git settings for the current project, including user.name and user.email.

Key Takeaways

  • Type git config user.name in the VS Code terminal to see the username set for your current repository.
  • Git usernames are stored per repository, so different folders can have different usernames configured.
  • If the command returns nothing, you have not yet set a username for that repository and will need to configure one before committing.
  • Use git config --global user.name to check the username that applies to all your repositories on this computer.

The difference between local and global usernames

Git lets you set a username in two ways: for one specific folder, or for your entire computer. When you run git config user.name, you are checking the local setting — the one that applies only to the repository you are currently in.

To check your global username instead, type git config --global user.name. This is the fallback name Git uses for any repository where you have not set a local username. Most people set a global username once and use it everywhere, then override it only when they need a different name for a specific project.

If you have set both a local and a global username, the local one takes priority. When you commit, Git uses the local username if it exists; otherwise it uses the global one.

Where to find the terminal in VS Code

The terminal panel sits at the bottom of the VS Code window by default. If you do not see it, press Ctrl+` (Windows and Linux) or Cmd+` (Mac) to open it. The backtick key is usually to the left of the 1 key on your keyboard.

You can also open the terminal through the menu: click Terminal at the top, then select New Terminal. A new terminal window will open at the bottom of your screen, and you can type your Git command there.

Make sure you are in the correct folder before you run the command. The terminal shows your current path at the left of each line. If you are in the wrong folder, use cd to navigate to the repository you want to check.

What to do if your username is not set

If git config user.name returns nothing, you need to set a username before you can commit. Type this command, replacing "Your Name" with the name you want to use:

git config user.name "Your Name"

This sets the username for the current repository only. If you want to set it for all repositories on your computer, add --global to the command:

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

After you run the command, type git config user.name again to confirm the username was saved. The name you entered should now print in the terminal.

Why Git needs your username

Every commit you make in Git is tagged with a username and email. This creates a record of who made each change, which matters when you are working with other people or reviewing your own history later. The username appears in your commit messages and in the log that shows who changed what and when.

The username does not have to be your real name — it can be a nickname, a handle, or anything else. What matters is that it is consistent and meaningful to the people who will read your commit history. Many teams use real names so it is clear who to ask about a change; others use GitHub usernames or initials.

If you have not set a username and you try to commit, Git will refuse and tell you to configure user.name and user.email first. Setting these once saves you from that error every time you commit.

Checking your username in the VS Code interface

You can also see your Git configuration without opening the terminal. Click the Source Control icon on the left sidebar — it looks like a branching line. At the top of the panel, you will see information about your repository, including which branch you are on.

However, the Source Control panel does not always display your username directly. The terminal method is more reliable. If you want to see your full Git configuration in one place, the terminal command git config --list is still your best option.

Frequently Asked Questions

Can I have a different Git username for different projects?

Yes. Set a global username with git config --global user.name, then use git config user.name "Different Name" (without --global) in any repository where you want a different username. Git will use the local setting for that repository and the global setting for all others.

Is my Git username the same as my GitHub username?

Not necessarily. Your Git username is what you configure on your computer; your GitHub username is your account name on GitHub. They can be the same, but they do not have to be. When you push code to GitHub, GitHub uses your account credentials, not your Git username, to identify you.

What if I see a long email address instead of a name?

You may have set your username to an email address by mistake, or Git may be showing your email instead. Run git config user.name to see what is actually set as your username, then use git config user.name "Your Actual Name" to change it to a real name if you prefer.

Does changing my username affect old commits?

No. Commits you have already made keep the username that was set when you made them. Changing your username only affects new commits going forward. If you need to change the author of old commits, that requires more advanced Git commands and is not recommended unless you have a specific reason.