# Setup: Install Git and connect to GitHub

Install Git and Git Credential Manager, create a GitHub account, and tell Git who you are.

Novice · Operating System · Git · Updated November 16, 2026

By Gregor Dzierzon

## After this lesson you can

- Configure Git with your name, email, default branch, and editor
- Explain how Git Credential Manager signs you in to GitHub

**macOS only.** Git saves the history of your code. GitHub stores that history online. In this exercise you install Git, create your GitHub account, and set Git up to use both.

## Install Git

macOS includes an older copy of Git with Apple's Command Line Tools. Install the current version with Homebrew:

```bash
brew install git
```

Close the Terminal window and open a new one, then run:

```bash
git --version
which git
```

You should see `git version 2.` followed by more numbers, and a path that starts with `/opt/homebrew` (or `/usr/local` on an Intel Mac). That path tells you the terminal is using Homebrew's Git.

## Create your GitHub account

If you already have a GitHub account, sign in at [github.com](https://github.com) and skip to the next section.

Otherwise, go to [github.com/signup](https://github.com/signup) and create a free account:

- Use an email address you will keep after the bootcamp.
- Choose a username you would be happy to show an employer. Your GitHub profile becomes part of your portfolio.

GitHub sends a code to your email to confirm it. Enter the code to finish.

## Tell Git who you are

Every commit you make is signed with a name and an email. Use your real name, and the **same email you used for GitHub**, so GitHub can link your commits to your account. Replace the example values with your own:

```bash
git config --global user.name "Alex Rivera"
git config --global user.email "alex.rivera@example.com"
```

Three more settings make Git easier to use in this bootcamp:

```bash
git config --global init.defaultBranch main
git config --global core.editor "code --wait"
git config --global pull.rebase false
```

The first names the main branch of every new repository `main`, the same name GitHub uses. The second tells Git to open VS Code when it needs you to type a message, and to wait until you close that file. The third tells `git pull` what to do when GitHub and your computer both have new commits: merge them. Without it, Git on a Mac stops and asks you to choose.

## Install Git Credential Manager

Git Credential Manager signs you in to GitHub through your web browser the first time you push code, then remembers you. You never have to create passwords or keys for Git.

```bash
brew install --cask git-credential-manager
```

Enter your Mac password if asked.

## Check your work

Run:

```bash
git config --global --list
git credential-manager --version
```

The first command lists your settings. You should see your `user.name`, your `user.email`, `init.defaultbranch=main`, `core.editor=code --wait`, `pull.rebase=false`, and a `credential.helper` line. The second shows a version number.

You will push your first code to GitHub, and see Git Credential Manager in action, in the last Setup exercise.

## Common problems

| What you see | What to do |
|---|---|
| `which git` shows `/usr/bin/git` | The terminal is still using Apple's Git. Open a new terminal window. If it still shows `/usr/bin/git`, repeat the Homebrew **Add Homebrew to your path** step. |
| A typo in your name or email | Run the same `git config --global` command again with the correct value. It replaces the old one. |
| No `credential.helper` line | Run `git credential-manager configure`, then check again. |

Source: https://www.ask-codey.com/lessons/os-and-terminal-tools-macos-setup-git-and-github
