Install Git | Atlassian Git Tutorial

Install Git on Mac

OS X

There are several ways to install Git on a Mac. In fact, if you’ve installed XCode (or its command-line tools), it’s possible that Git is already installed. To find out, open a terminal and enter git -version.

Apple actually maintains and ships its own Git fork, but it tends to lag behind conventional Git in several major releases. You may want to install a newer version of Git using one of the following methods

: Git Installer

for

Mac

The easiest way to install Git on a Mac is through the standalone installer:

1. Download the latest Git installer for Mac.

2. Follow the instructions to install Git.

3. Open a terminal and verify that the installation was successful by typing git -version:

4. Set up your Git username and email using the following commands, replacing Emma’s name with your own. These details will be associated with any confirmation you create:

5. (Optional) To have Git remember your username and password when working with HTTPS repositories, configure the git-credential-osxkeychain helper.

Install

Git with Homebrew

If you have installed Homebrew to manage packages on OS X, you can follow these instructions to install Git:

1. Open your terminal and install Git using Homebrew:

2. Verify that the installation was successful by typing which git -version:

3. Set up your Git username and email using the following commands, replacing Emma’s name with your own. These details will be associated with any confirmation you create:

4. (Optional) To have Git remember your username and password when working with HTTPS repositories, install the git-credential-osxkeychain helper.

Install

Git with MacPorts

If you have installed MacPorts to manage packages on OS X, you can follow these instructions to install Git:

1. Open your terminal and update MacPorts:

2. Look for the latest available Git ports and variants:

3. Install Git with bash completion, OS X Keychain Helper, and documents:

4. Set up your Git username and email using the following commands, replacing Emma’s name with your own. These details will be associated with any confirmation you create:

5. (Optional) To have Git remember your username and password when working with HTTPS repositories, configure the git-credential-osxkeychain helper.

Install the git-credential-osxkeychain helper

Bitbucket supports pushing and pulling your Git repositories over SSH and HTTPS. To work with a private repository over HTTPS, you must provide a username and password each time you press or pull. The git-credential-osxkeychain helper allows you to cache your username and password in the OSX keychain, so you don’t have to retype it every time.

1. If you followed the MacPorts or Homebrew instructions above, the helper should already be installed. Otherwise, you will need to download and install it. Open a terminal window and check:

If you receive a declaration of use, go to step 4. If the helper is not installed, go to step 2.

2. Use curl to download git-credential-osxkeychain (or download it through your browser) and move it to /usr/local/bin:

3. Make the file executable:

4. Configure git to use the osxkeychain credential helper.

The next time Git prompts you for a username and password, it will cache them in your keychain for future use.

Install Git with

Atlassian Sourcetree Sourcetree

,

a free visual Git client for Mac, comes with its own included version of Git. You can download Sourcetree here.

To learn how to use Git with Sourcetree

(and how to host your Git repositories on Bitbucket) you can follow our comprehensive tutorial on Git with Bitbucket and Sourcetree

.

Compiling Git from source code

in OS X

Creating Git can be a bit tricky on Mac due to certain libraries moving between OS X versions. In El Capitan (OS X 10.11), follow these instructions to build Git:

1. From your terminal install the XCode command line tools (if you have not already done so):

2. Install Homebrew.

3. Using Homebrew, install openssl:

4. Clone the Git source (or if you don’t already have a Git version installed, download and extract it):

5. To build Git run make with the following indications

:

Next step: Learn Git with Bitbucket Cloud Install Git

on Windows

Git standalone installer for Windows

1. Download the latest Git installer for Windows.

2. When you have successfully launched 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.

3. Open a command prompt (or Git Bash if during installation you chose not to use Git from the Windows command prompt).

4. Run the following

commands to set up your Git username and email using the following commands, replacing Emma’s name with your own. These details will be associated with any confirmation you create:

5. Optional: Install the Git credential helper

on Windows Bitbucket

supports pushing and pulling HTTP to your remote Git repositories on Bitbucket. Each time you interact with the remote repository, you must provide a user name and password combination. You can store these credentials, rather than providing the merge each time, with Git Credential Manager for Windows.

Install Git with

Atlassian Sourcetree Sourcetree

,

a free visual Git client for Windows, comes with its own included version of Git. You can download Sourcetree here.

To learn how to use Git with Sourcetree (and

how to host your Git repositories on Bitbucket) you can follow our comprehensive tutorial on

Git with Bitbucket and Sourcetree.

Next step: Learn Git with Bitbucket Cloud

Install Git on Linux Debian/Ubuntu

Git

packages

(apt-get)

are available via apt:

1. From your shell, install Git using apt-get:

2. Verify that the installation was successful by typing git -version:

3. Set up your Git username and email using the following commands, replacing Emma’s name with your own. These details will be associated with any commits you create

:

Fedora

Git packages (dnf/yum)

are available via yum and dnf:

1. From your shell, install Git using dnf (or yum, in earlier versions of Fedora): or

2. Verify that the installation was successful by typing git -version:

3. Set up your Git username and email using the following commands, replacing Emma’s name with your own. These details will be associated with any commits that

Build Git creates

from source code

on Linux

Debian/Ubuntu

Git requires the various dependencies to compile on Linux. These are available via apt:

1. From your shell, install the necessary dependencies using apt-get:

2. Clone the Git feed (or if you don’t already have a Git version installed, download and extract it):

3. To compile Git and install it under /usr, run make:

Fedora

Git requires the various dependencies to build on Linux. These are available via yum and dnf:

1. From your shell, install the necessary build dependencies using dnf (or yum, in earlier versions of Fedora): or using yum

. For yum, you may need to install the Extra Packages for Enterprise Linux (EPEL) repository first:

2. Symbolic link docbook2X to the filename waiting for the Git build:

3. Clone the Git source (or if you don’t already have a Git version installed, download and extract it):

4. To build Git and install it on /usr, run make

:

Next step: Learn Git with Bitbucket Cloud

Contact US