备份一个GitHub仓库 [英] Backup a GitHub repository

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

问题描述

根据以下要求创建GitHub上托管的git存储库的本地备份的最佳方式是什么?


  1. 本地备份应该是裸露的repo。

  2. 备份应该包含所有分支。

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

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

      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?:

    1. The local backup should be a bare repo.

    2. The backup should include all branches.

    3. 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/...
    

    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屋!

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