Installing Git and Initial Configuration
Git installation, git config, user name, user email, default editor, .gitconfig
Installing Git and Initial Configuration
Before using Git, you must install it on your system and configure your identity. Git uses your name and email to label every commit you make.
Installation
On Windows, download Git from git-scm.com and run the installer. On macOS, run xcode-select --install or install via Homebrew with brew install git. On Linux (Ubuntu/Debian), run sudo apt install git.
Configuring Your Identity
After installation, open a terminal and set your name and email:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"The --global flag applies these settings to every repository on your machine. You can override them per repository by running the same commands without the flag inside a specific project folder.
Setting the Default Editor
Git opens a text editor for commit messages. Set it to your preferred editor:
git config --global core.editor "code --wait"Replace code --wait with vim, nano, or any editor command. You can view all your configuration with git config --list.
Verifying the Installation
Run git --version in your terminal. You should see output like git version 2.x.x. If you see this, Git is correctly installed and ready to use.
