Install and configure Git

To begin contributing to GitLab projects, you must download and install the Git client on your computer.

This page provides information on installing Git on macOS and Ubuntu Linux.

For information on downloading and installing Git on other operating systems, see the official Git website.

Install and update Git

Though a version of Git is supplied by macOS, you should install the latest version of Git. A common way to install Git is with Homebrew.

To install the latest version of Git on macOS with Homebrew:

  1. If you’ve never installed Homebrew before, follow the Homebrew installation instructions.
  2. In a terminal, install Git by running brew install git.
  3. Verify that Git works on your computer:

    git --version
    

Keep Git up to date by periodically running the following command:

brew update && brew upgrade git

Configure Git

To start using Git from your computer, you must enter your credentials to identify yourself as the author of your work. The full name and email address should match the ones you use in GitLab.

  1. In your terminal, add your full name. For example:

    git config --global user.name "Sidney Jones"
    
  2. Add your email address. For example:

    git config --global user.email "your_email_address@example.com"
    
  3. To check the configuration, run:

    git config --global --list
    

    The --global option tells Git to always use this information for anything you do on your system. If you omit --global or use --local, the configuration applies only to the current repository.

After you set your name and email address, you should add an SSH key. See Use SSH keys to communicate with GitLab.