4

Possible Duplicate:
Backup of github repo

What is the simplest way in which I can backup a github repo and some time later (after deleting the repo on github) recreate the repo to that it's in the same state as it was before?

Among other concerns, I'm not sure if a simple clone will fetch all of the remote branches etc.

Community
  • 1
  • 1
GJ.
  • 5,226
  • 13
  • 59
  • 82
  • Have you tried a simple `clone`? I believe it will fetch all of the remote branches etc. – Neil Forrester May 21 '12 at 14:55
  • 2
    this is not a duplicate. The referenced question has a simple title, but adds a bunch of constraints within the body of the question, and also does not mention restore. I had the same simple and complete question as above and had to search around a lot to find a simple and complete answer, here's what works for me: backup: `git clone https://github.com/USER/REPOS --mirror ; cd REPOS.git/ ; git bundle create ../REPOS.git.bundle --all ; cd .. ; rm -rf REPOS.git` restore: `git clone REPOS.git.bundle REPOS` – Kai Carver Jan 22 '16 at 20:24
  • 1
    There are some options available on the GitHub marketplace: https://github.com/marketplace?query=backup One of the solutions may be to create a GitHub repository backup using Cloudback. The backup can be downloaded locally or saved in one of the most popular cloud storage. See https://github.com/marketplace/cloudback for more details. – Evgenii Kosiakov May 29 '21 at 13:10

1 Answers1

3

I'd probably use git clone --mirror $original, and restore it with git push.

See also:

Community
  • 1
  • 1
ellotheth
  • 4,333
  • 2
  • 17
  • 29