备份一个GitHub仓库 [英] Backup a GitHub repository
问题描述
根据以下要求创建GitHub上托管的git存储库的本地备份的最佳方式是什么?:
-
本地备份应该是裸露的repo。
备份应该包含所有分支。 > -
应该很容易(增量)更新备份。
基本上,我想要一个完美的镜子,可以轻松更新。因此,命令 The local backup should be a bare repo.
The backup should include all branches.
It should be easy to (incrementally) update the backup.
git clone --mirror git://github.com / ...
让我想起,但据我所知,这不允许简单的更新(我会有删除并重新创建我的本地备份)。另外,git clone的镜像选项看起来相当新,我没有在我正在使用的一些系统上(它有稍微旧的git运行版本)。
你对这类问题推荐的解决方案是什么?
创建镜像:
git clone --mirror git://github.com/user/project.git
更新:
cd project.git
git远程更新
在不更改当前目录的情况下更新:
git --git-dir project.git远程更新
What is the best way to create a local backup of a git repository hosted on GitHub, given the following requirements?:
Basically, I want a perfect mirror, with the possibility to update easily. As such, the command
git clone --mirror git://github.com/...
comes to mind, but as far as I can tell, that doesn't allow for an easy update (I'd have to delete and recreate my local backup). Also, the mirror option for git clone seems quite recent, I don't have it on some of the systems I'm working on (which have slightly older versions of git running).
What is your recommended solution for this kind of problem?
To create the mirror:
git clone --mirror git://github.com/user/project.git
To update:
cd project.git
git remote update
To update without changing the current directory:
git --git-dir project.git remote update
这篇关于备份一个GitHub仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!