Web developer, open source contributor, obsessed with systems, stationery, & Obsidian.

How to Create & Clone a GitHub Repo Locally


Before starting, do two things to ensure things run smoothly:

  1. make sure you’re running version 2.28 or later of git. You can check your version with git --version.
  2. Set your local default git branch to main. You can do so by running: git config --global init.defaultBranch main

Create your new repo in three steps:

  1. Log in to GitHub and click the + dropdown and click Create Repository.
  2. Type your repo name and check the box to add a README.txt file.
  3. Finally, click the green Create Repository button.

Clone the repo to your local computer:

  1. Open the repository you want to clone to your local machine.
  2. Click the green Code dropdown button.
  3. Choose SSH and click the copy button.
  4. Open Terminal (Mac OS) on your computer and cd into the folder you want to copy the repo into.
  5. Type git clone and paste the SSH text you’ve copied, which will look something like this  git clone
  6. That’s it; once it’s downloaded, you’ll see all the files in your local machine’s folder.

Optionally, if you don’t want to start off with GitHub, you can do this locally with git.

  1. Open Terminal and navigate to where you want to create this repository.
  2. Type mkdir nameofyourrepocreate then cd nameofyourrepocreate
  3. Once in the directory, type git-init
  4. Now you can create a file and use git add and git commit to save those changes in the local repository history.

Extra reading:

Leave a Reply

Your email address will not be published. Required fields are marked *