Skip to main content
The GitHub CLI (gh) lets you interact with GitHub from your terminal. BrainGrid uses it to connect with your repositories, create branches, and manage pull requests.

What is GitHub?

GitHub is a platform where developers store and collaborate on code. Think of it as a shared folder for your project’s code, where you can track every change, work with teammates, and review each other’s work. BrainGrid connects to GitHub to analyze your code and help manage your development workflow.

Create a GitHub Account

If you are going to build a BrainGrid requirement locally, you will first need the GitHub CLI installed to download the code and upload any changes you make. To use the GitHub CLI, you need a GitHub account.
1

Go to GitHub

Open github.com in your browser and click Sign up.
2

Enter your details

Provide your email address, create a password, and choose a username. Follow the verification steps to confirm your account.
3

Choose a plan

Select the Free plan. It includes everything you need to use BrainGrid.

Opening a Terminal

A terminal is a text-based application where you type commands. You’ll need one to install the GitHub CLI.
  1. Press Command + Space to open Spotlight Search
  2. Type Terminal
  3. Press Enter to open it
A window with a text prompt will appear — this is your terminal.

Install the GitHub CLI

The easiest way to install on Mac is with Homebrew, a popular package manager.
1

Install Homebrew (if you don't have it)

Paste this command into your terminal and press Enter:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Follow the on-screen instructions. You may need to enter your Mac password — the characters won’t appear as you type, but they are being entered.
If you already have Homebrew, you can skip this step. To check, type brew --version and press Enter. If you see a version number, it’s already installed.
2

Install the GitHub CLI

Run this command:
brew install gh
Wait for the installation to finish.
If you prefer not to use Homebrew, you can download the .pkg installer directly from the GitHub CLI releases page. Open the downloaded file and follow the installation wizard.

Verify the Installation

Close your terminal and open a new one (this ensures the new command is recognized). Then run:
gh --version
You should see output like gh version 2.x.x. If you see an error like “command not found”, try closing and reopening your terminal again.

Log In to GitHub

Before using the GitHub CLI, you need to connect it to your GitHub account:
1

Start the login process

Run this command:
gh auth login
2

Answer the prompts

The CLI will ask you a series of questions. Choose the following:
  1. Where do you use GitHub? → Select GitHub.com
  2. Preferred protocol for Git operations? → Select HTTPS
  3. Authenticate Git with your GitHub credentials? → Select Yes
  4. How would you like to authenticate? → Select Login with a web browser
3

Complete browser authentication

The CLI will display a one-time code and open your browser. Paste the code into the browser page and authorize access.Once complete, you’ll see a confirmation message in your terminal.

Verify Authentication

Run this command to confirm you’re logged in:
gh auth status
You should see your GitHub username and a confirmation that you’re logged in.

Troubleshooting

Close your terminal completely and open a new one. The terminal needs to restart to recognize newly installed commands.On Mac, if it still doesn’t work after restarting the terminal, run the command that matches your Mac’s chip. This is a temporary fix for the current session:
# Apple Silicon (M1/M2/M3/M4)
eval "$(/opt/homebrew/bin/brew shellenv)"

# Intel
eval "$(/usr/local/bin/brew shellenv)"
On Windows, try restarting your computer.
Your version of Windows may not include winget. Download the GitHub CLI installer directly from the releases page and run the .msi file.
This is your Mac user password (the one you use to log in to your computer). The characters won’t appear as you type — this is normal. Type your password and press Enter.
If the browser doesn’t open automatically, copy the URL shown in your terminal and paste it into your browser manually.
This typically means your Homebrew directory has incorrect ownership. Do not use sudo with brew commands — it can break your Homebrew installation.Instead, fix the directory ownership by running this command, then try installing again:
sudo chown -R $(whoami) $(brew --prefix)
You’ll be prompted for your Mac password.

Next Steps