Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export github repository

Tags:

git

github

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?

like image 768
Carl Avatar asked Oct 09 '16 05:10

Carl


People also ask

How do I download all Git repository?

The "clone" command downloads an existing Git repository to your local computer. You will then have a full-blown, local version of that Git repo and can start working on the project.


2 Answers

(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

like image 82
Do Nhu Vy Avatar answered Oct 17 '22 07:10

Do Nhu Vy


Beside forking it (which is a clone on the remote side: GitHub), you can also export it as a bundle.

From your own local clone, you can type (using git bundle)

git bundle create /tmp/myrepo.bundle --all

That will give you one file (easy to copy around), from which you can clone back your repo at any time.

cd /a/new/path
git clone /tmp/myrepo.bundle myrepo
cd myrepo
pwd
  /a/new/path/myrepo
like image 22
VonC Avatar answered Oct 17 '22 07:10

VonC