How to Copy/Duplicate a Git Repository With Full History

Tuesday, January 18, 2022
By: Matthew Doucette

A quick blog post to show how to create a full copy (or duplicate*) of a Git repository, with full commit history.

 

Failed Attempts:

  1. I copied a local Git repository and manually edited the Git files, namely the "url" in "config" file that points to the Git repository web URL. Git did not accept this hack.
  2. I could copy the local Git repository, delete the Git files/folders, and create a new project, but this would lose its commit history.
  3. *I could "duplicate" a Git repository, which sounds like what I want, but it requires a "mirror-push" and appears to create a mirror of the repository (that is still tied to the original, correct me if I am wrong). This is a duplicate, but I can see how it's not what people may want when they search how to duplicate a repository.

 

Successful Attempt - GitHub Importer:

GitHub Importer is the solution!

I can import my own Git respository to my own Git profile.

It allows you to rename the respository on import, so you can choose a new name.

The only issue I had, is that it wanted my login credentials over and over (and over and over...) again. The idea is that you are logging into someone else's Git profile to access their private repository, only I am logging into my own account from my own account. I think that messed it up somehow. The fix was to make the Git repository public and set it back to private after.

 

That is all.

 

 

About the Author: I am Matthew Doucette of Xona Games, an award-winning indie game studio that I founded with my twin brother. We make intensified arcade-style retro games. Our business, our games, our technology, and we as competitive gamers have won prestigious awards and received worldwide press. Our business has won $190,000 in contests. Our games have ranked from #1 in Canada to #1 in Japan, have become #1 best sellers in multiple countries, have won game contests, and have held 3 of the top 5 rated spots in Japan of all Xbox LIVE indie games. Our game engines have been awarded for technical excellence. And we, the developers, have placed #1 in competitive gaming competitions -- relating to the games we make. Read about our story, our awards, our games, and view our blog.