Git Installation: Main Tips
- There are many versions of Git available online for all operating systems.
- There are a few options how to install Git: you can install Git tools through package managers, other installers or source code compilation on the computer.
- After installation, you always have to configure user information - set username and email.
Git Installation On Windows
There are few ways how to get Git on Windows:
- Using Git download file for Windows.
- By using a package manager for Windows.
- Choosing to install it together with your favorite Git GUI.
After downloading the installation file from one of the listed websites, you will have to install Git yourself. Another way is to use an automated installation by getting the package manager. You can use Git Chocolaty for this method. It is a package monitor for Windows maintained by the community.
If you choose this method, after installing Chocolaty, type in a command window
choco install git -params '"/GitAndUnixToolsOnPath"'.
Also, one way you can get Git on your computer is by installing GitHub for Windows or other Git GUI - Sourcetree, GitKraken, etc. However, though it may be tempting, this is not a recommended option. Graphical user interface software usually has its limitations. Plus, once you learn how to operate a command line, it is easier to switch between systems.
We will learn more about specifics of set up after installation a little later.
Git Installation Mac OS
Mac also has a few ways how can you install Git on Mac OS. Here are a few options if you choose to install Git for Mac:
- Install the Xcode Command Line Tools.
- Use download file, a binary installer.
- Use a package manager.
The first way is one of the easiest. What you have to do is to install the Xcode Command Line Tools. If you already have it, newer versions of Mac OS may already have Git installed on your computer.
To check, type in the terminal the
$ git --version. This will show the version of git you have on your machine:
$ git --version
git version 2.15.1
If you don't have it, you will be asked to run the installation of Git on your machine. You can do this by running the command -
git in the terminal.
If you want more up currently to date version, you can also install it via installer from download source pages. For that, all you need to do is download the installation files for Mac. You can do this by visiting Git website or other websites like SourceForge.
To start the installation with Homebrew type in terminal:
$ brew install git
If you want to use MacPorts, firstly search for the most recent Git ports and variants available. You can do that by typing in the terminal the following lines:
$ port search git
$ port variants git
After that, type in the terminal:
$ sudo port install git +svn +doc +bash_completion +gitweb
Lastly, you can as well use an alternative to command line - GUI (Graphic User Interface) app like GitHub for Mac. However, it is important to have in mind that Git commands stays the same through different platforms, while GUIs may be different on different platforms.
Git Installation On Linux
The easiest way to get Git on Linux is through the binary installer. You can do this by using general package-management tools that come with your distribution. In your shell, you have to type specific commands.
For Fedora use dnf / yum:
$ sudo dnf install git-all
If you are on distribution based on Debian, for instance, Ubuntu, Git packages are available via apt:
$ sudo apt-get install git-all
If there is a need, for installation on other Unix like systems you can look for more options and instructions here.
You can check if the installation was successful by typing following command in a shell:
$ git --version
There are many ways to use Git. It has a lot of different dedicated tools to use. We mentioned that there is the option to download third-party Git GUI tools. However, Git comes with already built in GUI, as well as other different tools. In the future posts, we will focus on the command line because though it may look harder to use you will not lose any functionality. What is more, after you learn the command line version, you will relatively easily figure out how to use the GUI version.
As its name suggests, it is a command line prompt interpreter. If you use or have used Windows, you probably had seen one. If you work with Windows and are accustomed to using CMD, you can use it for git commands.
Bash in Git is emulation or a Unix shell for Linux and Mac OS, so you can use it on Windows if you are used to working with Linux.
It is a Graphical User Interface. This allows to use Git without touching Git Basch or CMD and avoid using command lines. However, built-in GUI has its limitation. On the one hand, it is very minimalistic. On the other hand, many GUI with different capabilities only can implicate a partial Git functionality. This why in this tutorial we will master using the command line.