Git Installation Guide
Getting Started with Git
This guide will help you install and configure Git on your operating system. Choose your platform below to get started.
Installing Git on Windows
Download Git for Windows
- Visit the official Git website at git-scm.com/downloads.
- Click on the Windows download link.
- The download should start automatically.
Install Git on Windows
- Run the downloaded executable file.
- Follow the installation wizard. The default options are generally suitable for most users.
- During installation, select 'Use Git from the Windows Command Prompt' to add Git to your PATH.
- Complete the installation process and click 'Finish'.
Configure Git
After installation, you need to set up your user name and email address. This information is used with every Git commit.
git config --global user.name "Your Name"git config --global user.email "your.email@example.com"Verify Installation
To confirm that Git has been installed correctly, open a terminal or command prompt and run:
git --versionGenerate SSH Keys
SSH keys enable secure connection to Git hosting services like GitHub, GitLab, or Bitbucket without entering passwords for every push/pull.
Additional Configuration
Here are some recommended additional settings to configure Git for optimal use:
Configure Line Endings
Different operating systems handle line endings differently. Configure Git to handle them properly:
# Windowsgit config --global core.autocrlf true # macOS/Linuxgit config --global core.autocrlf inputSet Default Branch Name
Modern Git workflows typically use 'main' as the default branch name instead of 'master':
git config --global init.defaultBranch mainConfigure Default Editor
Set your preferred text editor for Git commit messages and other operations:
# For VSCodegit config --global core.editor "code --wait" # For Vimgit config --global core.editor vimTroubleshooting
Here are solutions to common problems during Git installation and configuration: