Git Installation and Configuration
This chapter will guide you through installing Git on different operating systems and performing basic configurations to get ready for learning.
Git Installation
Windows Installation
Method 1: Official Installer (Recommended)
-
Download Installer
- Visit Git Official Website
- Download the version suitable for your system (32-bit or 64-bit)
-
Installation Steps
-
Verify Installation
Method 2: Package Managers
macOS Installation
Method 1: Homebrew (Recommended)
Method 2: Official Installer
- Visit Git Official Website
- Download the .dmg file
- Double-click the package and follow instructions
Method 3: Xcode Command Line Tools
Linux Installation
Ubuntu/Debian
CentOS/RHEL/Fedora
Arch Linux
Compiling from Source (All Linux Distributions)
Basic Configuration
After installation, some basic configurations are needed to use Git normally.
Configure User Information
This is mandatory before using Git, as every commit uses this information:
Notes:
- Username can be in English or other languages.
- Email should be a real email, especially if you want to match it with GitHub, etc.
--globalmeans this configuration applies to all repositories on your system.
Configure Default Editor
Git needs to open an editor for certain operations. You can configure your favorite one:
Configure Line Ending Handling
Different operating systems use different characters for line endings. Git can handle this automatically:
Configure Default Branch Name
Since Git 2.28, you can configure the default branch name: