Git – How to Export GitHub Repository

gitgithub

I have a project I am working on that is currently on in a repository on my GitHub.
I am doing as a part of my degree, I will be shortly handing it over to the client

I was wondering if there is a way to export the entire repository including all the branches and related history so that it can be stored prior to handing on to future developer?

Best Answer

(1) Use git archive (for backup one branch) like the below command (Suppose you are inside Git local repository):

git archive master --format=zip --output=java_exmamples.zip

you will see file java_exmamples.zip (in the same folder) is the backup of master branch.


(2) Use git bundle (for backup all branches)

A real example:

git clone --mirror https://github.com/donhuvy/java_examples.git
cd java_examples.git/
git bundle create repo.bundle --all

repo.bundle is the file what you need (full back up) in the same directory.

How to restore from file repo.bundle:

git clone repo.bundle

Reference

https://git-scm.com/docs/git-archive

https://git-scm.com/docs/git-bundle

http://rypress.com/tutorials/git/tips-and-tricks#bundle-the-repository

Related Question