Git and Gitbash Installation

Instructions for both Windows and Mac OS git installations

Overview

In this section we will install git for both windows and mac as well as gitbash for windows. We did not have to install git before on C9 because it was included with the linux ubuntu version we were using. So lets git started by going to your OS install instructions below.‌

Git for Mac

Overview

There are several ways to install Git on a Mac. The easiest is probably to install the Xcode Command Line Tools. On Mavericks (10.9) or above you can do this simply by trying to run git from the Terminal the very first time.‌

Installation

Open a terminal on your machine and run the following command.

$ git --version

If you don’t have it installed already, it will prompt you to install it.Git XCODE Install Prompt‌

If you want a more up to date version, you can also install it via a binary installer. A macOS Git installer is maintained and available for download at the Git website, at http://git-scm.com/download/mac.‌

Confirm Install

Lets check the install by starting Git, run the following command in our terminal:

$ git

Git Succesful Install

Success if you have the same output as the above image. Continue to Git User Config

Git and Git Bash for Windows

Overview

For windows we have to install not only git, but git bash as well. In C9 we were using a bash shell to write all our commands in the terminal. Windows uses a different shell by default, PowerShell. If do not install git bash all the commands you are used to using in the terminal will not work. For example, ls and cd command would be something different.‌

Windows - Active Developer Mode

First, verify that you've got the most recent release of Windows and update if not.‌

Now, we need to activate developer mode in Settings. Open Settings (by typing "settings" in Cortana at the bottom left of your screen) and choose "Update & Security" then "For developers", and then turn on "Developer mode" if it's not already selected.Updating Windows Settings

You may be prompted to install additional packages (and you should do this if prompted) and a restart may be required (which you should also do).‌

Install Git

Now we need to install Git for Windows. Download and run the installer, which you'll find a link to here. The installer will prompt you through several setup screens. You should select the default option for each one, with the exception of the "Select components" screen, where you may opt to add a Git Bash icon to your desktop.Git Bash Installer‌

Once the installation has finished, you can open Git for Bash by clicking on Cortana and typing "Git Bash").

Congrats! You've now got a Linux-like command line environment running in Windows. Continue to Git User Config

Git User Config

In this section we will be configuring Git so it will use the right account information.

GIT must be installed for this section.‌

Set your Commit email and username (Global Scope)

We are letting Git know what our default email and usernames are for every commits on any project... You can also do this on a project by project basis, but we will instead choose to set our default values globally by running the following commands in your terminal‌

EMAIL:

$ git config --global user.email <email@example.com>

USERNAME:

$ git config --global user.name <Mona Lisa>

Check Our Config Settings

The following commands should printout your username and email you entered in the previous step. If they do not repeat the step above.‌

Email:

$ git config --global user.email

Username:

$ git config --global user.name

Success! Your Git Account is now setup.‌

Recap

You installed Git and if you were a windows users Bash as well, since windows does not come with it. After that you setup Git to use your existing user information.

Last updated