Skip to main content

How to install Git

There are several ways to install Git on a Mac. In fact, if you’ve installed XCode (or it’s Command Line Tools), Git may already be installed. To find out, open a terminal and enter git –version.

$ git --version
git version 2.7.0 (Apple Git-66)

Apple actually maintain and ship their own fork of Git, but it tends to lag behind mainstream Git by several major versions. You may want to install a newer version of Git using one of the methods below:

Git for Mac Installer

The easiest way to install Git on a Mac is via the stand-alone installer:

Download the latest Git for Mac installer.
Follow the prompts to install Git.
Open a terminal and verify the installation was successful by typing git –version:


$ git --version
git version 2.9.2

Configure 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 you create:


$ git config --global user.name "Your Name"
$ git config --global user.email "name@email.com"

(Optional) To make 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:

    $ brew install git
  2. Verify the installation was successful by typing which git --version:

    $ git --version
    git version 2.9.2
  3. Configure 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 you create:

    $ git config --global user.name "Your Name"
    $ git config --global user.email "name@email.com"
  4. (Optional) To make Git remember your username and password when working with HTTPS repositories, install the git-credential-osxkeychain helper.

Git for Windows stand-alone installer

  1. Download the latest Git for Windows installer.
  2. When you’ve successfully started the installer, you should see the Git Setup wizard screen. Follow the Next and Finishprompts 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 elected not to use Git from the Windows Command Prompt).
  4. Run the following commands to configure 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 you create:

    $ git config --global user.name "Your Name"
    $ git config --global user.email "yourname@email.com"
  5. Optional: Install the Git credential helper on Windows
    Bitbucket supports pushing and pulling over HTTP to your remote Git repositories on Bitbucket. Every time you interact with the remote repository, you must supply a username/password combination. You can store these credentials, instead of supplying the combination every time, with the Git Credential Manager for Windows.

Install Git on Linux

Debian / Ubuntu (apt-get)

Git packages are available via apt:

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

    $ sudo apt-get update
    $ sudo apt-get install git
  2. Verify the installation was successful by typing git --version:

    $ git --version
    git version 2.9.2
  3. Configure 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 you create:

    $ git config --global user.name "Your Name"
    $ git config --global user.email "name@email.com"

Fedora (dnf/yum)

Git packages are available via both yum and dnf:

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

    $ sudo dnf install git

    or

    $ sudo yum install git
  2. Verify the installation was successful by typing git --version:

    $ git --version
    git version 2.9.2
  3. Configure 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 you create

    $ git config --global user.name "Your Name"
    $ git config --global user.email "name@email.com"

[:en]

There are several ways to install Git on a Mac. In fact, if you’ve installed XCode (or it’s Command Line Tools), Git may already be installed. To find out, open a terminal and enter git –version.

$ git --version
git version 2.7.0 (Apple Git-66)

Apple actually maintain and ship their own fork of Git, but it tends to lag behind mainstream Git by several major versions. You may want to install a newer version of Git using one of the methods below:

Git for Mac Installer

The easiest way to install Git on a Mac is via the stand-alone installer:

Download the latest Git for Mac installer.
Follow the prompts to install Git.
Open a terminal and verify the installation was successful by typing git –version:


$ git --version
git version 2.9.2

Configure 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 you create:


$ git config --global user.name "Your Name"
$ git config --global user.email "name@email.com"

(Optional) To make 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:

    $ brew install git
  2. Verify the installation was successful by typing which git --version:

    $ git --version
    git version 2.9.2
  3. Configure 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 you create:

    $ git config --global user.name "Your Name"
    $ git config --global user.email "name@email.com"
  4. (Optional) To make Git remember your username and password when working with HTTPS repositories, install the git-credential-osxkeychain helper.

Git for Windows stand-alone installer

  1. Download the latest Git for Windows installer.
  2. When you’ve successfully started the installer, you should see the Git Setup wizard screen. Follow the Next and Finishprompts 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 elected not to use Git from the Windows Command Prompt).
  4. Run the following commands to configure 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 you create:

    $ git config --global user.name "Your Name"
    $ git config --global user.email "yourname@email.com"
  5. Optional: Install the Git credential helper on Windows
    Bitbucket supports pushing and pulling over HTTP to your remote Git repositories on Bitbucket. Every time you interact with the remote repository, you must supply a username/password combination. You can store these credentials, instead of supplying the combination every time, with the Git Credential Manager for Windows.

Install Git on Linux

Debian / Ubuntu (apt-get)

Git packages are available via apt:

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

    $ sudo apt-get update
    $ sudo apt-get install git
  2. Verify the installation was successful by typing git --version:

    $ git --version
    git version 2.9.2
  3. Configure 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 you create:

    $ git config --global user.name "Your Name"
    $ git config --global user.email "name@email.com"

Fedora (dnf/yum)

Git packages are available via both yum and dnf:

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

    $ sudo dnf install git

    or

    $ sudo yum install git
  2. Verify the installation was successful by typing git --version:

    $ git --version
    git version 2.9.2
  3. Configure 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 you create

    $ git config --global user.name "Your Name"
    $ git config --global user.email "name@email.com"

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *