Set Email and Username in the Specific Project in GIT
To check the global email and username set in Git, you can use the following commands:
Check global username:
git config --global user.name
Check global email:
git config --global user.email
Set a specific email and username
To set a specific email and username for the current project only in Git, you can configure Git at the repository level using the following commands. This allows you to use a different identity for a particular project without affecting your global Git configuration.
Step 1: Navigate to Your Project Directory
Open your terminal or command prompt and navigate to the directory of your project:
cd open_source\keriderya
Step 2: Set Local Git Username and Email
To set the username and email for this specific project, use the following commands:
Set the email for the current project:
git config user.email "gayaresthird@gmail.com"
Set the username for the current project:
git config user.name "Thirdy Gayares"
Step 3: Verify the Local Configuration
To verify that the username and email are set correctly for the current project, run:
git config --local --list
You should see something like:
user.name=Thirdy Gayares
user.email=gayaresthird@gmail.com
Explanation:
git config --local
modifies the.git/config
file within the current project. This ensures that the changes only affect the current project and do not alter the global settings.Global settings can be checked by running
git config --global --list
, which contains the default username and email for all repositories unless overridden by local settings.
This way, Git will use the specified email and username for commits made in this project.