The system of software versioning Git is not installed by default on operating systems Linux, Windows and MacOS.
Even if it has already been installed, it is a good idea to update to the latest version.
Each of the systems has a different way to do this installation, and, by default, once performed, the Git commands are available through the command terminal or console. You can install it as a package or through another installer, or even download the source code and compile it.
Next you will see how to install the git on major operating systems and on different Linux distributions.
Install Git on Windows
There are a few ways to install Git on Windows. The most official version is available for download from the Git website.
Access the address https://git-scm.com/download/win and the download will start automatically. Note that this is a project called Git for Windows, which is separate from the main Git project itself; for more information about it, go to the page https://gitforwindows.org.
To download an automated installation, you can use the Git Chocolatey package. Watch that the Chocolatey package is maintained by the community. Even so, each version of each package goes through a rigorous moderation process before going live, which typically includes:
- Security, consistency and quality verification
- installation test
- Virus Scanning Using VirusTotal
- Moderated by humans who perform the final review and sign them
One more way to install Git on Windows is by installing the GitHub for Windows. The installer includes a command-line version of Git as well as the GUI.
It also works fine with PowerShell, and configures solid credential caching and proper CRLF settings.
In other articles/lessons I will deal with credentials and CRLV settings
You can download it from the GitHub for Windows page at https://windows.github.com.
Install Git on Mac
As with Windows, there are several ways to install Git on a Mac. The easiest is to install the Xcode command line tools.
On Mavericks (10.9) or above, you can do this by simply running the `git` command in the Terminal Console for the first time. If it is not installed, the system will ask you to install it.
If you want to work with the most up-to-date version, usually not available at the same speed in the repositories, you can install it using a binary installer.
An OSX Git installer is maintained and available for download from the Git website, go to http://git-scm.com/download/mac to download the installer.

You can also install it as part of the GitHub installer for Mac. Your GUI Git tool has an option to install command line tools.
To download this tool, go to the GitHub for Mac page at http://mac.github.com.
Install Git on Linux
The process of installing Git on Linux/Unix is usually done through the basic package management tool that comes with your distribution.
Since Git is an essential tool for developers and infrastructure professionals, DevOps, the packages for its installation are always present and well updated.
fedora
For Linux distributions that use the package manager yum
, like Linux Fedora for example, you can use the following command:
$ sudo yum install git-all
Use yum
will work for Fedora up to version 21, for Fedora 22 and newer use dnf
:
$ dnf install git
Debian, Ubuntu, Mint
If you use a Linux based Debian distribution like Ubuntu or Mint, use the package manager apt-get
:
$ sudo apt-get install git-all
You can use the following official repository for the latest versions, it should work for all three Debian based distributions:
$ add-apt-repository ppa:git-core/ppa $ apt update $ apt install git
Gentoo
$ emerge --ask --verbose dev-vcs/git
Arch Linux
$ pacman -S git
OpenSUSE
$ zypper install git
mageia
$ urpmi git
Nix/NixOS
$ nix-env -i git
FreeBSD
$ pkg install git
Solaris 9/10/11 (OpenCSW)
$ pkgutil -i git
Solaris 11 Express
$ pkg install developer/versioning/git
OpenBSD
$ pkg_add git
alpine
$ apk add git
Red Hat Enterprise Linux, Oracle Linux, CentOS, Scientific Linux, et al.
RHEL and derivatives typically provide older versions of git. You can download a tarball and compile from source or use a third-party repository such as IUS Community Project to get a newer version of git.
Simple as that, running the correct installation command for your distribution, Git will be available, to test you can check your version with the following command:
$ git --version
keep up to date
Don't forget to follow me on twitter and sign the Mazer.dev channel on Youtube to receive updates on new articles, video lessons and free courses in software development and engineering.
Pingback: How to configure username and email per project with Git - MAZER.DEV
Pingback: Basic Git - Introduction and Essential Commands - MAZER.DEV