导出github存储库

时间:2016-10-09 05:30:00

标签: git github

我正在处理的项目目前正在我的GitHub上的存储库中 我作为学位的一部分,我将很快将其交给客户

我想知道是否有办法导出整个存储库,包括所有分支和相关历史记录,以便在传递给未来的开发人员之前存储它?

2 个答案:

答案 0 :(得分:4)

(1)使用 git archive (对于备份一个分支),如下面的命令(假设您在Git本地存储库中):

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

您将看到文件java_exmamples.zip(在同一文件夹中)是主分支的备份。


(2)使用 git bundle (用于备份所有分支)

一个真实的例子:

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

repo.bundle是您在同一目录中所需的文件(完整备份)。

如何从文件repo.bundle恢复:

git clone repo.bundle

<强>参考

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

答案 1 :(得分:2)

除了分叉(这是偏远方面的克隆:GitHub)之外,您还可以export it as a bundle

您可以在自己的本地克隆中输入(使用git bundle

cd /a/new/path
git clone /tmp/myrepo.bundle myrepo
cd myrepo
pwd
  /a/new/path/myrepo

这将为您提供一个文件(易于复制),您可以随时克隆回购邮件。

{{1}}
相关问题