How to Duplicate a Git Repo and Copy Git History

Summary

$ git clone --bare "https://github.com/username/git-repo-name"
$ git push --mirror https://github.com/exampleuser/new-repository.git
$ git clone 'https://github.com/omartheman/Omars-New-Project.git'

Step 1: Create a blank remote repo (our target repo)

Step 2: Create a bare clone of the repo

Info about a bare git repo, for those who want to know

Step 3: Push a mirror of the bare clone to the remote repo

$ cd old-repository.git
$ git push --mirror https://github.com/exampleuser/new-repository.git

Step 4: Clone new remote repo into local machine

$ cd 'our-destination-parent-folder'
$ git clone 'https://github.com/omartheman/Omars-New-Project.git'

Step 5 (optional): Add new repo to GitHub Desktop

That’s it!

--

--

--

Hi! I am a React devloper who loves technology and learning new things in all different fields. I wish you the best success in your life :)

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Using Continuous Integration pipeline to guard against database performance regressions

The 5 Misconceptions of Sponsoring a Virtual Conference

Coordinate in MatLab.

Building and deploying a spring boot application to kubernetes

Hyperautomation — The next big thing in Tech in 2021

What Are You Doing With Raw Data You are Collecting?

A Trading Strategy Using a Combination of Technical Indicators

Introducing the new ArangoDB Datasource for Apache Spark

Introducing the new ArangoDB Datasource for Apache Spark

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Omar Shishani

Omar Shishani

Hi! I am a React devloper who loves technology and learning new things in all different fields. I wish you the best success in your life :)

More from Medium

Changes of the User Interface Development

Hypemasters insiders — Anton Shilin, Server Developer

How we developed the secretary service to resolve tasks from hommie to business

Increase Your Supply Chain Efficiency with your own Supply Management Software (SMSo)