Git Configuration
Before you start using Git, you need to configure it with your user details. This information will be associated with your commits.
Check Git Version
First, verify that Git is installed and check its version:
git --version
User Setup
Set your name and email address. This information will be used in your commits:
git config --global user.name "Your Name" git config --global user.email "your-email@example.com"
Note: Use the same email address that you used to create your GitHub account.
Global Configuration
The --global
flag sets the configuration for all repositories on your system. These settings are stored in your home directory.
git config --global core.editor code
This sets VS Code as your default editor. You can use vim
, nano
, or any other editor.
Local Configuration
You can also set configuration for a specific repository by omitting the --global
flag:
git config user.name "Your Name" git config user.email "your-email@example.com"
This is useful when you want to use different credentials for different projects.
List All Configuration
View all your Git configuration settings:
git config --list
This will show all configuration settings including global and local settings.
Editor Setup
Change the default code editor to VS Code (recommended):
git config --global core.editor "code --wait"
The --wait
flag tells Git to wait for you to close the editor before continuing.
Configuration Complete!
Your Git is now configured. Let's learn the basic Git commands and workflows.