备份 GitHub 存储库 [英] Backup a GitHub repository

查看:38
本文介绍了备份 GitHub 存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在满足以下要求的情况下,为托管在 GitHub 上的 git 存储库创建本地备份的最佳方法是什么?:

  1. 本地备份应该是一个裸仓库.

  1. The local backup should be a bare repo.

备份应包括所有分支.

(增量)更新备份应该很容易.

It should be easy to (incrementally) update the backup.

基本上,我想要一个完美的镜像,并且可以轻松更新.因此,命令

Basically, I want a perfect mirror, with the possibility to update easily. As such, the command

git clone --mirror git://github.com/...

我想到了,但据我所知,这不允许进行简单的更新(我必须删除并重新创建我的本地备份).此外,git clone 的镜像选项似乎很新,我在我正在使用的某些系统上没有它(运行的 git 版本稍旧).

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?

推荐答案

创建镜像:

git clone --mirror git://github.com/user/project.git

更新:

cd project.git
git remote update

在不改变当前目录的情况下进行更新:

To update without changing the current directory:

git --git-dir project.git remote update

这篇关于备份 GitHub 存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆