The fastest way to check your Git username
Your Git username is stored in your local Git configuration file. To see it right now, open your terminal or command prompt and type git config user.name, then press Enter. The name that appears is your configured username — the one Git uses when you commit code.
If nothing appears, your username hasn't been set yet. This is common on a fresh Git installation. You'll see how to set one in the section below.
You can also check your email address the same way: type git config user.email and press Enter. Both pieces of information are stored together and used for the same purpose — to identify who made each commit in your project history.
Key Takeaways
- Type git config user.name in your terminal to see your configured username when ready.
- If no name appears, your username hasn't been set, and you'll need to configure it before making commits.
- The same command works on Windows (Command Prompt or PowerShell), Mac (Terminal), and Linux (any terminal).
- Your username and email are stored in a hidden file called .gitconfig in your home directory, but the command above is the easiest way to view them.
Where Git stores your username
Git keeps your username in a configuration file called .gitconfig, which lives in your home directory. On Windows, that's usually C:\Users\YourName. On Mac and Linux, it's ~/ (your home folder). The file is hidden by default — the dot at the start tells your operating system not to show it in normal file browsing.
You don't need to open this file directly. The git config command reads it for you and displays what you need. But if you're curious, you can view the whole file by typing git config --list in your terminal. This shows all your Git settings at once, including user.name, user.email, and other configuration options.
Setting a username if you don't have one
If git config user.name returned nothing, you need to set a username before you can commit code. Type this command and replace "Your Name" with whatever name you want Git to use:
git config --global user.name "Your Name"
The --global flag means this username will be used for every Git project on your computer. If you want a different username for just one project, navigate into that project's folder and run the same command without --global.
You should also set your email address the same way:
git config --global user.email "your.email@example.com"
After you run these commands, type git config user.name again to confirm the username was saved.
Checking username for a specific project
If you've set a global username but want to know whether a particular project uses a different one, navigate into that project's folder in your terminal and type git config user.name (without the --global flag). Git will show you the project-specific username if one exists, or fall back to your global setting if it doesn't.
This is useful when you work on both personal projects and work projects — you might want your work email and name for one and your personal details for the other. The project-level setting always takes priority over the global one.
Viewing all your Git configuration at once
If you want to see everything Git knows about your setup, type git config --list. This shows your username, email, default editor, and dozens of other settings. The output can be long, so you might see settings you don't recognize — those are Git's built-in defaults.
To see only the settings you've actually changed yourself, type git config --list --local (for the current project only) or git config --list --global (for your whole computer). This filters out the noise and shows just what you've configured.
Checking your GitHub or GitLab username
Your Git username (the one stored in .gitconfig) is different from your GitHub or GitLab username. Git is the version control system itself — it runs on your computer. GitHub and GitLab are websites where you can upload and share your Git projects.
Your Git username is what appears in your commit history. Your GitHub username is what appears in your GitHub profile URL — for example, github.com/yourname. You can have any Git username you want, but your GitHub username is set when you create your account and is harder to change.
If you're pushing code to GitHub or GitLab, you'll need both: your Git username (for local commits) and your GitHub/GitLab username (for authentication when you push). They don't have to match.
Troubleshooting: username shows but looks wrong
If git config user.name returns a name you don't recognize or don't want to use, you can change it with the same command you used to set it. Type git config --global user.name "New Name" and Git will update it when ready.
Keep in mind that changing your username only affects commits you make from this point forward. Any commits you've already made will still show the old name in the history. This is by design — Git doesn't rewrite history when you change your configuration.
Frequently Asked Questions
Can I have different usernames for different projects?
Yes. Set a global username with --global, then navigate into a specific project folder and run the same command without --global to override it for just that project. Git will use the project-level setting when you commit in that folder.
What if git config user.name returns nothing?
Your username hasn't been set yet. Run git config --global user.name "Your Name" to set it. After that, the command will return your name. You should also set your email with git config --global user.email "your.email@example.com".
Is my Git username the same as my GitHub username?
No. Your Git username is stored locally on your computer and appears in your commit history. Your GitHub username is your account name on GitHub's website. They can be different, and you need both if you push code to GitHub.
Can I see who made a commit if I know their username?
Yes. Type git log --author="Name" to see all commits made by someone with that name. You can also type git log to see all commits in order, with the author name shown for each one.