How to Set Up Git Username and Email on Ubuntu
Git username and email setup on Ubuntu links your identity to every code change you make so collaborators know who wrote the work. Git is a version control system (a tool that tracks changes to project files over time) that stamps your name and email onto every save.
Running two quick terminal commands sets up this information in less than 60 seconds so your contributions get the right credit on platforms like GitHub.
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
Verify that Git is installed on your machine before configuring your username and email. Opening the terminal and running this command handles missing installations:
sudo apt update sudo apt install git
Configure Git Username and Email
You can configure your username and email right from the terminal using the git config command.
Settings apply globally or per repository. Running the git config command with the --global option establishes global commit names and email addresses.
Setting your Global Username
Open the terminal.
Run this command to set a global Git username:
git config --global user.name "User_name"
Substitute "Your Name" with the preferred name or username for Git commits.
Setting your Global Email Address
Run this command in the terminal to set a global email address (replacing your_email@example.com with the actual address):
git config --global user.email "your_email@example.com"
Substitute "your_email@example.com" with the actual email address linked to the Git or GitHub account.
Setting Username and Email for a Single Repository
You can set a different Git username and email for a single repository on Ubuntu without changing your global settings. This is useful when you want to use a work email for one project and a personal email for another. Open your terminal, go to your project folder, and use the git config command to save your details just for that 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
Checking settings via the git config --list command follows username and email configuration.
git config --list
Output displays all Git configuration settings. Locating user.name and user.email verifies the configurations.
Checking Global Configuration
git config --global user.name git config --global user.email
Checking Local Configuration
You can check your saved local Git settings on Ubuntu to make sure your username and email are correct before you make any commits. Open your project folder in the terminal and run specific git config commands to view the author details attached to that exact project so your work is always credited properly.Correct information finalizes the Git setup process. Subsequent commits automatically apply the configured username and email address.
Re-running the
git configcommand with new values modifies existing settings when necessary.Configuration complete.
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?
Changing names associated with Git commits utilizes the git config command. Updated names appear on all subsequent commits pushed 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!