The process to install Git differs in each operating system. Here in this tutorial we will discuss about Windows, Linux and MAC operating system.
There are a couple of different ways to install Git
on Windows. We recommend using an unofficial installer called msysGit.
To get started, head over to their website, download their installer and install it onto your
computer.
To verify that Git has been installed properly, open the
Command Prompt from Start > Windows System, or by pressing Windows + R then typing cmd and clicking
OK.
Enter the following command
:
git --version
If installed properly, you should see some output like this :
git version 2.15.1
You’re your system is ready for adding some global configuration for Git.
Open up your preferred terminal emulator and run the following commands:
# CentOS
sudo yum install git
# Debian/Ubuntu
sudo apt-get update
sudo apt-get install git
# Fedora
sudo dnf install git
To verify that Git has been installed properly, run the following command:
git --version
If installed properly, you should see some output like this:
git version 2.15.1
You’re your system is ready for adding some global configuration for Git.
Open the Terminal app which can be found in Applications > Utilities. In the window that appears, enter the following command and press return:
git --version
If Git has already been installed on your MAC, you’ll see some output like this:
git version 2.15.1
However, if it hasn’t you’ll be prompted to install the Command Line Tools.
Alternatively, there’s an official Git installer for macOS.
Once it’s finished downloading, open the installer, and follow the installation wizard using all the default options and preferences.
To verify that Git has been installed successfully, open up the Terminal app and enter the following command:
git --version
If installed properly, you should see some output like this:
git version 2.15.1
You’re your system is ready for adding some global configuration for Git.
Scripts are run from top to bottom, so make sure they’re in the correct sequence.
If you are using multiple scripts then ensure that those are also in the order. You can review the order sequence of the scripts in the Scripts Tab.
Once you’ve verified that Git has been installed successfully, open the Terminal in Linux or MAC OS(Command Prompt if you’re on Windows) and run the following two commands to configure Git to use your name and e-mail address:
git config --global user.name "Your Name"
git config --global user.email"[email protected]"
This will create a hidden file called .gitconfig
in your home directory which will
contain contents similar to the following:
[user]
name = Your Name
email = [email protected]
This information is used by Git to populate the author information when you commit your changes in the form of commits.
Both your name and e-mail address will be visible to anyone who has access to your repositories, so make sure you’re using an e-mail address you don’t mind sharing!
That’s it.