How to Set Up Git Username and Email on Ubuntu
Setting a Git username and email on Ubuntu links your identity to every code change you make so collaborators know who wrote the work. Git is a version control system that acts like a digital history book for your project files, tracking each modification you save.
Every time you save a change—called a commit—Git stamps your name and email onto that version. Running two quick commands in the Ubuntu terminal sets this up in less than a minute, ensuring 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
Verifying Git installation on the machine precedes configuring usernames and emails. Opening the terminal and running this command handles missing installations:
sudo apt update sudo apt install git
Configure Git Username and Email
Ready systems handle username and email configuration through 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
Ubuntu allows configuring Git usernames and emails for single project folders. Separate project requirements benefit from unique author details. Opening the project folder in the terminal and applying the 'git config' command assigns names and emails to that specific 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
Checking saved project settings on Ubuntu confirms correct configuration. Terminal execution provides direct verification. Runninggit config user.namedisplays the username whilegit config user.emailreveals the email associated with that project.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!