How to Install Git on your local machine

Here’s the simple rule — you’re a developer means that you ABSOLUTELY have to have Git installed on your machine. In this post, we'll quickly look at how this can be done on your Linux, macOS and Windows machines.

Linux

The way we install Git on a Linux machine, or the way to do it rather, is dependent on the distribution you’re using, because of the tools that come packaged with them.

If you sue Fedora or any other distribution that is similar to it such as RHEL or CentOS, open Terminal and run the following command:

If the distribution you’re using is a Debian based one, like Ubuntu, you can try running the following command in Terminal

In either case, the command will require you to enter your administrate password, after which the system will take care of the installation process. If you need information on installing Git in other Linux distros, or for more details regarding Git installation in Linux systems, check out this page.

macOS

Good news for developers using macOS is that if you’ve installed XCode and XCode command line tools, Git is probably installed in your system. You can verify this by running the following command in Terminal:

if you have a valid installation, you’ll see something like this:

Apple maintains a fork of Git which it ships out. The problem here is that more often than not, Apple’s version is at least a couple of versions behind the original Git project. So let’s go ahead and look at methods to set up Git on macOS

The Installer

  1. Download the free Git for Mac installer.
  2. Follow the on-screen instructions and complete the installation process.

That should do the trick. If you now re-run the ‘git -version’ command in the Terminal, you should get a version number.

Using Homebrew

If you have the most popular package manager for macOS a.k.a Homebrew installed, you can use it to install Git. Open Terminal and run the following command:

Homebrew will now run the steps and scripts to install Git. If you now re-run the ‘git -version’ command in the Terminal, you should get a version number.

Windows

The Installer

  1. Download the free Git for Windows installer.
  2. 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.

If all went well, Git should be set up on your system now. Let’s verify this. Open a Command Prompt (or Git Bash if during installation you elected not to use Git from the Windows Command Prompt). Run the following command:

You should be able to see a version number now.

While the above list does not include ALL the ways to set up Git on your system, these are the most popular and tested ones and should be good for everybody

Interested in having a 1:1 chat with me over this story, or Angular, Typescript and Javascript in general? Head over to Hire The Author and let’s connect!

Software Developer | Blogger | Part-time Nerd

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store