The fastest way to see your Git username
Run git config user.name in your terminal or command prompt. That command returns the name Git has stored for you on your current machine. If nothing appears, Git does not yet know who you are on that computer.
The username Git uses is separate from your GitHub username, GitLab username, or any other service. Git stores it locally in a configuration file. When you commit code, Git attaches this name to every change you make — so it matters that it matches what you intend.
If you want to see both your stored name and email address at once, run 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 to see the name Git has stored for you on your current machine.
- Git's stored username is not the same as your GitHub or GitLab account name — they are separate settings.
- If the command returns nothing, Git has not been configured yet on that computer, and you will need to set it before making commits.
- Use git config --list to see all your Git settings, including name, email, and other configuration options, in one command.
Why Git stores a username separately from your account
When you work on a project, Git records who made each change. It does this by storing a name and email address with every commit. That name and email come from your local Git configuration, not from your GitHub account or any remote service.
This separation exists because Git itself is not tied to any single hosting platform. You can use Git with GitHub, GitLab, Gitea, or your own server. Git needs to know who you are on your machine, independent of where you push your code later. Your GitHub username might be alice-dev, but your Git configuration might say your name is Alice Chen — and both are correct in their own context.
The name you set in Git is what appears in commit history and in pull requests. If you work on multiple machines, each one can have a different Git configuration, though most people keep them the same for consistency.
Checking your Git configuration on different operating systems
The command is the same on Windows, macOS, and Linux: git config user.name. Open your terminal (or Command Prompt on Windows), type that command, and press Enter.
On Windows, if you installed Git Bash, use the Git Bash terminal rather than Command Prompt — it handles Git commands more reliably. On macOS, use Terminal or any terminal process. On Linux, use your default terminal.
If you see an error like "git: command not found", Git is not installed on your machine or is not in your system path. You will need to install Git before you can check or set your username.
What to do if Git has no username set yet
If git config user.name returns nothing or an error, you need to set your username before you can commit. Run git config --global user.name "Your Name", replacing "Your Name" with the name you want Git to use.
The --global flag sets this name for all projects on your machine. If you want to set a different name for just one project, navigate into that project's folder and run the same command without --global. You should also set your email with git config --global user.email "your.email@example.com".
After you set both, run git config user.name again to confirm the change took effect.
Checking username for a specific project only
If you work on multiple projects and want different names for different ones, you can set a project-specific username. Navigate into the project folder, then run git config user.name "Project Name" without the --global flag.
Git checks for settings in this order: project-specific first, then global, then system-wide. So if you set a global name and a project-specific name, Git uses the project-specific one for that folder only. To see which setting is actually in effect for your current project, run git config user.name from inside that project folder.
This approach is useful if you commit work under your own name for personal projects but under a company name for work projects.
Understanding what git config --list shows you
Running git config --list displays all your Git settings at once. You will see lines like user.name=Your Name, user.email=your.email@example.com, and many others related to how Git behaves on your machine.
If you have both global and project-specific settings, git config --list shows both. When Git needs to use a setting, it picks the most specific one — so a project-specific setting overrides a global one. The output can be long; if you want to focus on just user settings, run git config --list | grep user on macOS or Linux, or git config --list | findstr user on Windows.
Frequently Asked Questions
Is my Git username the same as my GitHub username?
No. Your Git username is stored on your computer and is what appears in commit history. Your GitHub username is your account name on GitHub's website. They can be different. When you push code to GitHub, GitHub knows who you are based on your SSH key or login credentials, not your Git username.
Can I change my Git username after I have already made commits?
Yes. Changing your Git username only affects new commits going forward. Old commits keep the name that was set when you made them. If you want to change the name on past commits, that requires rewriting history, which is complex and not recommended unless you have a strong reason.
What happens if I do not set a Git username?
Git will refuse to let you commit. You will see an error asking you to set user.name and user.email. You must configure these before you can save any changes to a repository.
Why does my Git username not match my GitHub profile?
Git and GitHub are separate systems. Your Git configuration is local to your machine. Your GitHub account is on GitHub's servers. You can set any name in Git, and it does not have to match your GitHub username. When you push to GitHub, GitHub identifies you by your SSH key or login, not by your Git username.
Can I have different Git usernames on different machines?
Yes. Each machine has its own Git configuration. You can set one username on your laptop and a different one on your desktop. Most people keep them the same for consistency, but Git allows you to configure each machine independently.