Skip to content

How to Set Up Git Username and Email on Ubuntu

Richard
Written by
Richard
Jan 25, 2024 Updated Mar 19, 2026 3 min read
How to Use Sticky Notes in Windows 11

You set up your Git username and email on Ubuntu using simple terminal commands.

Git is a distributed version control system that tracks changes to your files. Every time you make a commit, Git attaches your configured username and email to that record, ensuring your contributions are properly attributed.

This is crucial for project history and collaboration, especially on platforms like GitHub or GitLab, where your name will appear next to every change you push.

Configuring your Git identity on Ubuntu is straightforward and ensures your work is always recognized accurately, even when collaborating with multiple developers on a project.

⚡ Quick Answer

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:

🐧Bash / Shell
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.

You can set this 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:

💻Code
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:

💻Code
git config --global user.email "your_email@example.com" 

Replace "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

You can set a different Git username and email just for one project if needed. To do this, first open your project’s folder on Ubuntu using the ‘cd’ command, then use ‘git config user.name’ and ‘git config user.email’ to add your specific details for that repository.

Navigate to the project directory:

Command Prompt
cd path/to/your/project 

Set the local username for this repository:

💻Code
git config user.name "Project Specific Name" 

Set the local email address for this repository:

💻Code
git config user.email "project_specific_email@example.com" 

Verifying your Configuration

After configuring your username and email, you can check your settings with the git config --list command.

💻Code
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

💻Code
git config --global user.name
git config --global user.email

Checking Local Configuration

After setting up your Git username and email on Ubuntu, you'll want to check that they're correct. You can easily check your local Git username by typing 'git config user.name' in your terminal, and check your email with 'git config user.email'.



If the information is correct, your Git setup is finished! 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 config command 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?

About Git usernames 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?

Was this helpful?
Richard

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!

Leave a Comment

Your email address will not be published. Required fields are marked *

Exit mobile version