【问题标题】:Options for Copying Git Repo复制 Git 存储库的选项
【发布时间】:2014-02-14 17:22:59
【问题描述】:

我目前有一个私有 git 存储库,我想创建一个与私有存储库的单个分支同步的公共存储库。这些是我的要求:

  • 不要包含所有提交到私有仓库的全部历史记录
  • 轻松将更新从私人仓库推送到公共副本

我尝试了此处概述的镜像选项,但它复制了所有分支并且还包括了所有以前的提交。

https://help.github.com/articles/duplicating-a-repository

【问题讨论】:

    标签: git github mirror


    【解决方案1】:

    您可以在本地目录中设置 2 个上游。有点类似于您设置分叉回购的方式。这是一个例子

    $ git init
    $ git remote add public https://username@github.com/username/public.git
    $ git remote add private https://username@github.com/private/private.git
    $ git pull private the-branch
    $ git add -A
    $ git commit -m "moving private to public"
    $ git push --set-upstream public master
    

    【讨论】:

    • 这就是我要找的,谢谢!唯一的事情是从公共回购中删除以前的提交。你对如何做到这一点有什么建议吗?再次感谢您的帮助!
    • 我真的没有!我以前从来没有这样做过。也许这会有所帮助:sethrobertson.github.io/GitFixUm/fixup.html#remove_deep
    猜你喜欢
    • 2011-05-28
    • 1970-01-01
    • 1970-01-01
    • 2016-11-13
    • 2011-01-23
    • 1970-01-01
    • 1970-01-01
    • 2019-05-01
    • 2013-07-02
    相关资源
    最近更新 更多