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.Go to GitHub
Open github.com in your browser and click Sign up.
Enter your details
Provide your email address, create a password, and choose a username. Follow the verification steps to confirm your account.
Opening a Terminal
A terminal is a text-based application where you type commands. You’ll need one to install the GitHub CLI.- Mac
- Windows
- Press Command + Space to open Spotlight Search
- Type Terminal
- Press Enter to open it
Install the GitHub CLI
- Mac
- Windows
The easiest way to install on Mac is with Homebrew, a popular package manager.
Install Homebrew (if you don't have it)
Paste this command into your terminal and press Enter: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.Alternative: download the installer
Alternative: download the installer
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 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:Answer the prompts
The CLI will ask you a series of questions. Choose the following:
- Where do you use GitHub? → Select
GitHub.com - Preferred protocol for Git operations? → Select
HTTPS - Authenticate Git with your GitHub credentials? → Select
Yes - How would you like to authenticate? → Select
Login with a web browser
Verify Authentication
Run this command to confirm you’re logged in:Troubleshooting
'command not found' after installing
'command not found' after installing
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:On Windows, try restarting your computer.
'winget' is not recognized (Windows)
'winget' is not recognized (Windows)
Your version of Windows may not include
winget. Download the GitHub CLI installer directly from the releases page and run the .msi file.Homebrew installation asks for a password (Mac)
Homebrew installation asks for a password (Mac)
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.
Browser doesn't open during login
Browser doesn't open during login
If the browser doesn’t open automatically, copy the URL shown in your terminal and paste it into your browser manually.
'Permission denied' errors (Mac)
'Permission denied' errors (Mac)
This typically means your Homebrew directory has incorrect ownership. Do not use You’ll be prompted for your Mac password.
sudo with brew commands — it can break your Homebrew installation.Instead, fix the directory ownership by running this command, then try installing again: