Is it possible to create a duplicate of my own GitHub repository?

I have a GitHub repository named Web-Development-Guide-Examples that contains sample code for my book about web development basics. I just finished writing an updated version of the book focused on advanced web development techniques.

I need to keep the original repository unchanged because there are many external references to it online and people still need access to the basic examples. However, I also want to create a new repository called Advanced-Web-Development-Examples with updated code samples and additional new examples.

I tried using the standard fork feature but it seems like GitHub doesn’t allow you to fork your own repositories. Using branches won’t work for my situation since I specifically need separate repositories with distinct names that people can easily find and reference.

I could create a completely new repository and upload everything from scratch, but that seems inefficient since all the base code already exists in my original repository. What’s the best approach to handle this scenario? Is there a way to duplicate my own repository or do I need to start fresh with a new one?

simplest way is just download the zip file from your original repo and upload it to a new one if you dont need the git history. works great when you want a clean start for the advanced version without all the old commits cluttering things up.

actually you can just clone your repo locally then push it to a new remote repository. create the new repo on github first, then git clone your original one, change the remote url with git remote set-url origin [new-repo-url] and push. takes like 2 minutes and keeps all your commit history intact unlike the template approach.

Another option is using the GitHub import tool which works really well for this scenario. Navigate to Sign in to GitHub · GitHub and enter your existing repository URL as the source. This method preserves the complete commit history and all branches while creating an entirely separate repository. I’ve done this several times when splitting projects into different versions and it handles everything automatically without needing command line work. The import process typically takes just a few minutes depending on repository size. Once imported, you get a completely independent repository that you can rename to Advanced-Web-Development-Examples. The main advantage over manual cloning is that GitHub handles all the heavy lifting and there’s less chance of accidentally messing up the git configuration during the process.

You could also consider creating a bare clone which is particularly useful when you need to maintain the exact same repository structure and history. The process involves running git clone --bare on your original repository, then pushing that bare clone to your new repository location. This method differs from a regular clone because it copies all refs and git data without creating a working directory first. I used this approach when I needed to duplicate a large codebase for a client project where maintaining the complete git history was crucial for tracking code evolution. The bare clone method ensures you get an exact replica including all branches, tags, and commits. After the bare clone completes, you simply push everything to your new Advanced-Web-Development-Examples repository and delete the temporary bare clone folder. This technique is especially beneficial when dealing with repositories that have complex branching structures or important tag references that you want to preserve in the new repository.

GitHub’s template repository feature is exactly what you need for this situation. Go to your original repository settings and check the “Template repository” box. Once enabled, you can use the green “Use this template” button to create a new repository with all the same files and structure but with a completely independent history. I’ve used this approach multiple times when maintaining different versions of documentation repositories. The template method gives you a clean slate while preserving all your existing code structure. Unlike forking, it creates a truly separate repository that won’t show the fork relationship, which sounds perfect for your use case since you want distinct repositories for basic and advanced examples. After creating the new repository from the template, you can rename it to Advanced-Web-Development-Examples and start adding your updated content. This approach is much more efficient than manually recreating everything from scratch.