How to Set Up Git Username and Email on Ubuntu
Setting up your Git username and email on Ubuntu connects your identity to code changes you make.
Git is a tool that tracks every change to your project files, like a digital history book for your code. When you save a change (called a “commit”), Git adds your username and email to that saved version.
This ensures everyone knows who made what changes, which is super important when working with others on platforms like GitHub. You’ll see your name next to every update you send.
Getting this right on Ubuntu means your contributions are always credited correctly, especially when you’re part of a team.
Configure your Git username and email on Ubuntu using the terminal. Run `git config –global user.name “Your Name”` and `git config –global user.email “your_email@example.com”` to set your global credentials.
Installing Git
Before we dive into setting your username and email, make sure Git is installed on your machine. If it’s not, open your terminal and run this command:
sudo apt update sudo apt install git
Configure Git Username and Email
Once Git is ready, you can configure your username and email. This is done using the git config command.
This can be set globally or for a specific repository. To set your global commit name and email address, run the git config command with the --global option.
Setting your Global Username
Open your terminal.
Type the following command to set your global Git username:
git config --global user.name "User_name" Replace "Your Name" with your name or the username you want to use for your Git commits.
Setting your Global Email Address
In the terminal, enter the following command to set your global email address:
git config --global user.email "your_email@example.com" "your_email@example.com" with your actual email address. This should be the email address linked to your Git or GitHub account.Setting Username and Email for a Single Repository
It’s possible to set your Git username and email for just one specific project folder on Ubuntu. This is useful if you want to use different details for different projects. Open your project folder in the terminal and use the ‘git config’ command to add your name and email for that particular project.
Navigate to the project directory:
cd path/to/your/project Set the local username for this repository:
git config user.name "Project Specific Name" Set the local email address for this repository:
git config user.email "project_specific_email@example.com" Verifying your Configuration
After configuring your username and email, check your settings with the git config --list command.
git config --list
This will show all your Git configuration settings. Look for user.name and user.email to verify your configurations.
Checking Global Configuration
git config --global user.name git config --global user.email
Checking Local Configuration
After you set your Git username and email for a specific project on Ubuntu, it's smart to check if they were saved correctly. You can do this right in the terminal. Typegit config user.nameto see your username andgit config user.emailto see your email for that project.Once the information is correct, your Git setup is complete. Any commits you make from now on will use your configured username and email address.
If you ever need to change these settings, run the
git configcommand again with your new values.That's it!
Conclusion:
- Configuring your Git username and email is crucial for ensuring proper attribution of your commits
- The proper contact information associated with your commits can facilitate communication with other developers
- Installing Git and configuring your username and email are essential steps for a smooth Git setup on Ubuntu Linux
Can we change Git config username and email?
You can change the name that is associated with your Git commits using the git config command. The new name you set will be visible in any future commits you push to GitHub from the command line.
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.
No comments yet — be the first to share your thoughts!