Check your Git username and email from the command line
Open your terminal or command prompt and run these two commands, one at a time:
To see your username: Type `git config user.name` and press Enter. Git will print whatever name you set for commits.
To see your email: Type `git config user.email` and press Enter. Git will print the email address tied to your commits.
If either command returns nothing, that setting has not been configured yet on your machine. If you see a name and email, those are the values Git will use the next time you commit code. This is the fastest way to check what you have right now without looking at configuration files.
Key Takeaways
- Run `git config user.name` to see your configured username and `git config user.email` to see your configured email address.
- An empty response means that setting does not exist yet and needs to be configured before you make commits.
- These settings are stored locally on your machine and control what name and email appear in your commit history.
- You can set or change both values using `git config user.name "Your Name"` and `git config user.email "your@email.com"`.
- Git checks local project settings first, then falls back to global settings if no local value exists.
See all your Git settings at once
Instead of checking username and email separately, you can view your entire Git configuration by typing `git config --list` and pressing Enter. This prints every setting Git knows about on your machine, including user.name, user.email, and many others.
Scroll through the output to find the lines that start with `user.name` and `user.email`. The values after the equals sign are what you are looking for. This method is faster if you want to check multiple settings or verify that other configurations are in place.
The `--list` output can be long, so you may see dozens of lines. Look for the user settings near the top or use your terminal's search function (Ctrl+F on Windows, Cmd+F on Mac) to jump straight to the lines you need.
Understand local versus global settings
Git stores configuration at two levels: global (applies to every project on your machine) and local (applies only to one specific project folder).
When you run `git config user.name` without any flags, Git checks the local setting first. If no local setting exists, it falls back to the global one. If you want to see only your global settings, run `git config --global --list` instead. This is useful if you use different names or emails for different projects — for example, a work email for your employer's repositories and a personal email for your own.
To see only local settings for your current project, run `git config --local --list`. This shows you what has been configured just for that folder, separate from your machine-wide defaults.
What to do if your settings are wrong or missing
If the username or email is incorrect, or if Git returned nothing, you can set them when ready. Run `git config user.name "Your Actual Name"` to set your username, and `git config user.email "your.email@example.com"` to set your email.
These commands set the values locally for your current project. If you want to use the same name and email across all projects on your machine, add the `--global` flag: `git config --global user.name "Your Actual Name"` and `git config --global user.email "your.email@example.com"`. After you set them, run the check commands again to confirm the values took effect.
If you have already made commits with the wrong name or email, changing the configuration will only affect future commits. Past commits keep their original author information unless you rewrite the commit history, which is a more advanced step.
Why Git needs your username and email
Every time you commit code, Git records who made that change by storing your username and email in the commit history. This creates an audit trail so other developers (or you, months later) can see who changed what and when. The email does not have to match any account — Git does not validate it against a mail server — but using a real email makes it easier for others to contact you about your changes.
If you are working on a team repository hosted on GitHub, GitLab, or another platform, that platform may also use your email to link commits to your account on their site. Using the same email you registered with makes that connection automatic. Without the correct email, your commits may appear as unlinked or attributed to an unknown author on those platforms.
Where Git stores your configuration files
Git saves your settings in plain text files on your computer. Global settings live in a file called `.gitconfig` in your home directory (the folder that opens when you type `cd ~` in your terminal). Local settings for a specific project are stored in a hidden folder called `.git/config` inside that project's directory.
You can open and edit these files directly with any text editor if you prefer, but using the `git config` commands is safer and less error-prone. If you do edit the files by hand, make sure you follow the correct format — a mistake in the file syntax can cause Git to behave unexpectedly.
Frequently Asked Questions
Can I have different usernames for different projects?
Yes. Set a global username with `git config --global user.name`, then navigate to a specific project folder and run `git config user.name "Different Name"` without the `--global` flag. That project will use the local name for commits, while all other projects use the global one.
Does my Git email have to be a real email address?
Technically no — Git does not validate it. But using a real email is a good practice because platforms like GitHub use it to link commits to your account, and it makes you reachable if someone has questions about your code.
What if I see multiple user.email lines when I run git config --list?
You likely have both a global and a local setting. Git uses the local one for that project. Run `git config user.email` (without `--list`) to see which one is actually active, or run `git config --local user.email` and `git config --global user.email` separately to see both.
Do I need to restart anything after changing my Git settings?
No. Git reads the configuration file each time you run a command, so changes take effect when ready. Your next commit will use the new username and email.
How do I check my settings on a shared or work computer?
Run the same commands — `git config user.name` and `git config user.email` — to see what is currently set. If you are on a shared machine, check whether settings are global or local to avoid affecting other users' projects. You can set local values for just your work projects without changing the global configuration.