How to Set Up GitHub on Mac and Link Your First Project

New to Git? Learn how to set up GitHub on your Mac, configure Git, and link your first project to a GitHub repository step-by-step.

When you are coding your website you will do so on your personal device locally. To connect your website to a hosting provider such as Vercel or Render you will want to put your project in the cloud with GitHub.

The folder on your personal computer that contains all the code files for your website will be stored in GitHub as a repository just a fancy name for a folder in the cloud with special abilities like version control.

Once your personal folder is linked to GitHub you can submit updates known as pushing commits to GitHub. When a commit has been successfully pushed to GitHub via the terminal your GitHub repository will automatically update to the lasted version you have on your personal computer.

You can also pull a repository from GitHub to work on your personal computer but generally I find myself pushing updates vs having to pulling repository 90% of the time.

To set all of this up you will need to install Git and create a GitHub account. To install Git you should install a Homebrew, a package manager that helps you install software from the command line much easier.

Step 1: Install Homebrew and confirm it is installed by checking the version

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew --version

Step 2: Install Git and confirm it is installed by checking the version

brew install git
git --version

Step 3: Provide Git details of who you are which should ideally match what you use for creating your GitHub account and then verify as well.

git config --global user.name "Your Name"
git config --global user.email "Your Email"
git config --list

Not with Git out of the way you want to create a GitHub account. Then you want to click create a New Repository. Generally for most projects such as your website you will want to select private.

For private repositories you need to be authenticated. Go to your profile photo in the top right corner of the GitHub dashboard and click settings. In the left sidebar click developer settings. You will see a Personal access tokens tabs and underneath Tokens (classic). Select that option and then click Generate a new token. Specify the permissions you wish to use for your project, set the expiration date, and add a note for what you are using the token for, then click Generate Token. Hold onto that token somewhere safe.

Now we will need to use that token to connect to GitHub. You don’t want to always be pasting that token in the terminal when asked so run this command:

git config --global credential.helper osxkeychain

This stores your token in your macOS Keychain so you don’t have to type them again.

Go back and click New Repository and then click Create Repository.

After creating the repository you will see a list of commands you need to run within in your terminal within the folder on your personal computer that you are using for project (in this case a website).

git init
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/your-username/your-repository-name.git
git push -u origin main

Note: You will likely be asked to enter your token when trying to push to GitHub. Enter your token. Afterwards you should no longer need to be asked to enter it when you push to GitHub.

Voilà your project is linked. If you ever make updates to your project on your personal computer you need to run these commands to update your GitHub repository with the latest version on your personal computer.

git add *
git commit -m "second commit"
git push origin main

Instead of git push origin main you could just type git push since you specified earlier with the -u flag that you want updates to go to your main branch.

Github is great because you can have multiple branches aka versions of your project saved in GitHub. Generally you will only be updating one branch, aka your main branch to make it simple.

That’s it! When you decide to deploy your project to a hosting provider like Vercel you will need to provide them a token to access your private repository.

No fluff. Just real projects, real value, and the path from code to cash — one useful build at a time.

Copyright 2025 Matthew Seiwert