Git Setup
Before using Git, you need to install it on your system and configure some basic settings such as your name and email. These details will be attached to every commit you make.
1. Install Git
Download and install Git from the official website: git
Git is available for:
After installation, verify that Git is installed correctly by running:
git --versionYou should see something like:
git version 2.x.x
2. Configure Your Identity
Git requires a username and email to identify who made each commit.
Run the following commands in your terminal:
git config --global user.name "Your Name"
git config --global user.email "your@email.com"The --global flag means this configuration will apply to all repositories on your computer.
3. Check Your Configuration
To see your current Git configuration, run:
git config --listThis will display your Git settings, including your username and email.
user.name=Your Nameuser.email=your@email.com
4. Default Branch Name (Optional)
You can define the default branch name for new repositories:
git config --global init.defaultBranch mainThis ensures that newly created repositories start with the main branch instead of master.