How to copy a GitHub repo without forking

A simple guide

Posted by CYC on September 9, 2022

This blog is modified from moose-horizons

How to copy a GitHub repo without forking

GitHub only lets you fork a repo once, if you want to make more than one copy of a project here’s how you can do it. Useful for starter code.

  1. Create a new empty folder for your project and initialize git

     $ cd where-you-keep-your-projects
     $ mkdir your-project-name
     $ cd your-project-name
     $ git init
    
  2. “Pull” the repo you want to copy:

     # git url is the same as the clone URL
     $ git pull git-url-of-the-repo-you-want-to-copy
    
  3. Create a new repository for your project on GitHub
  4. Push your code to the new repository you just created (Push an existing repository from the command line)

     $ git remote add origin git-url-of-the-new-repo-you-created
     $ git branch -M main
     $ git push -u origin main