What is Git?
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.
Git was created by Linus Torvalds in 2005 for development of the Linux kernel, with other kernel developers contributing to its initial development. This is by far, the most widely used modern version control system in the world today. Git has been designed with performance, security and flexibility in mind.
How to install Git?
1. Install Git on Windows
Download the latest Git for Windows installer.
When you’ve successfully started the installer, you should see the Git Setup wizard screen. Follow the Next and Finish prompts to complete the installation. The default options are pretty sensible for most users.
Open a Command Prompt (or Git Bash if during installation you selected not to use Git from the Windows Command Prompt).
Run the following commands to configure your Git username and email using the following commands, replacing my name with your own. These details will be associated with any commits that you create:
$ git config --global user.name "Safi Choudhury"
$ git config --global user.email "[email protected]"
2. Install Git on Linux
Install on Fedora / Redhat / CentOS (yum/dnf)
Git packages are available via both yum and dnf:
From your shell, install Git using dnf (or yum, on older versions of Fedora):
$ sudo yum install git
or
$ sudo dnf install git
Verify the installation was successful by typing git --version
:
$ git --version
git version 2.9.2
Configure your Git username and email using the following commands, replacing Emma’s name with your own. These details will be associated with any commits that you create
$ git config --global user.name "Safi Choudhury"
$ git config --global user.email "[email protected]"
Install on Debian / Ubuntu (apt-get)
Git packages are available via apt:
From your shell, install Git using apt-get:
$ sudo apt-get update
$ sudo apt-get install git
Verify the installation was successful by typing git --version
:
$ git --version
git version 2.9.2
Configure your Git username and email using the following commands, replacing Emma’s name with your own. These details will be associated with any commits that you create:
$ git config --global user.name "Safi Choudhury"
$ git config --global user.email "[email protected]"
3. Install Git on Mac
The easiest way to install Git on a Mac is via the stand-alone installer:Download the latest Git for Mac installer.
Follow the prompts to install Git.
Open a terminal and verify the installation was successful by typing git --version
:
$ git --version
git version 2.9.2
Configure your Git username and email using the following commands, replacing Emma’s name with your own. These details will be associated with any commits that you create:
$ git config --global user.name "Safi Choudhury"
$ git config --global user.email "[email protected]"
(Optional) To make Git remember your username and password when working with HTTPS repositories, configure the git-credential-osxkeychain helper.
Install Git with MacPorts
If you have installed MacPorts to manage packages on OS X, you can follow these instructions to install Git:
Open your terminal and update MacPorts:
$ sudo port selfupdate
Search for the latest available Git ports and variants:
$ port search git
$ port variants git
Install Git with bash completion, the OS X keychain helper, and the docs:
$ sudo port install git +bash_completion+credential_osxkeychain+doc
Configure your Git username and email using the following commands, replacing Emma’s name with your own. These details will be associated with any commits that you create:
$ git config --global user.name "Safi Choudhury"
$ git config --global user.email "[email protected]"
(Optional) To make Git remember your username and password when working with HTTPS repositories, configure the git-credential-osxkeychain helper.
Install Git with Homebrew
If you have installed Homebrew to manage packages on OS X, you can follow these instructions to install Git:
Open your terminal and install Git using Homebrew:
$ brew install git
Verify the installation was successful by typing which git --version
:
$ git --version
git version 2.9.2
Configure your Git username and email using the following commands, replacing Emma’s name with your own. These details will be associated with any commits that you create:
$ git config --global user.name "Safi Choudhury"
$ git config --global user.email "[email protected]"
(Optional) To make Git remember your username and password when working with HTTPS repositories, install the git-credential-osxkeychain helper.