We already know basic What is Git in previous tutorial. Next We will do the installation and preparation to start learning Git.
This tutorial is divided into three parts:
- How to Install Git on Linux.
- How to Install Git on Windows.
- The initial configuration must be done after installing Git.
How to Install Git on Linux
Debian/Ubuntu distro family you can use the command
apt to install latest Git release.
# apt-get install git
Ubuntu, this PPA provides the latest stable upstream Git version:
# add-apt-repository ppa:git-core/ppa # apt update; apt install git
# yum install git (up to Fedora 21)
# dnf install git (Fedora 22 and later)
# emerge --ask --verbose dev-vcs/git
Arch Linux release:
# pacman -S git
# zypper install git
# urpmi git
# nix-env -i git
#pkg install git
Solaris 9/10/11 (OpenCSW) release:
#pkgutil -i git
Solaris 11 Express release:
# pkg install developer/versioning/git
# pkg_add git
$ apk add git
Red Hat Enterprise Linux, Oracle Linux, CentOS, Scientific Linux, et al. RHEL and derivatives typically ship older versions of git. You can build from source by downloading a tarball source, or use a 3rd party repository such as the IUS Community Project to obtain a more recent version of git.
$ tazpkg get-install gi
To verify which Git version installed, you can type this command:
# git --version
On my computer, git version installed is 2.17.0
How to Install Git on Windows
Navigate to : https://www.git-scm.com/download/win and get the latest installer version, you can use either 32 bit or 64 bit version depends on your system. The installation is easy because you only need to follow the installation wizard, and you good to go to use git. But, there are some step you need to do if you want to use Git in windows command line.
Following step will guide you to install Git on Windows.
After you have download the installer from link above, launch it and the installation wizard will show up. You only need to follow “Next and next process”.
Select additional components that you need to installed.
Select the default text editor that you prefer.
Select the default option to add PATH environment, so you can run git from command line.
Choose SSL Library which will be used for HTTPS transport backend connection.
Select default option to convert the line ending from LF to CRLF when checking out text files. When committing text files, CRLF will be converted to LF. For cross-platform projects, this is the recommended setting on Windows.
Choose default option to use MinTTY as default terminal emulator.
Select which extra features would you like to enable.
Wait while installer is still in progress.
You can now hit Finish button when finished.
Well done. You have installed Git Windows. Now try to verify git version in command line. (Shortcut Windows+R, and type
cmd press enter).
Next step, you will learn how to add repository.