• Migrate repo from Gitlab to Github


    本文转自https://gist.github.com/mariozig/bd3bb50593e6d911946b

    # Assume we are in your home directory
    cd ~/
    
    # Clone the repo from GitLab using the `--mirror` option
    $ git clone --mirror git@your-gitlab-site.com:mario/my-repo.git
    
    # Change into newly created repo directory
    $ cd ~/my-repo.git
    
    # Push to GitHub using the `--mirror` option.  The `--no-verify` option skips any hooks. 
    $ git push --no-verify --mirror git@github.com:mario/my-repo.git
    
    # Set push URL to the mirror location
    $ git remote set-url --push origin git@github.com:mario/my-repo.git
    
    # To periodically update the repo on GitHub with what you have in GitLab
    git fetch -p origin
    git push --no-verify --mirror

    when migration has big file issue:

    1). Clone with –mirror from Gitlab
    
    git clone --mirror https://your-gitlab-site.com/mario/my-repo.git
    
    2). Use BFG to clear tree and reduce repo size
    
    java -jar bfg-1.13.0.jar --strip-blobs-bigger-than 50M my-repo.git
    git reflog expire --expire=now --all && git gc --prune=now –-aggressive
    
    3). Push to github with --mirror
    
    git push --mirror --no-verify https://github.com/mario/my-repo.git > push.log 2>&1

     这样会有一个问题,这种情况bfg会保护当前版本(HEAD所指的版本),不去清理。提示如下:

    Protected commits
    -----------------
    
    These are your protected commits, and so their contents will NOT be altered:
    
     * commit ******* (protected by 'HEAD')

     解决方法:

    java -jar bfg-1.13.0.jar --strip-blobs-bigger-than 50M my-repo.git --no-blob-protection
    HTTPS://gist.GitHub.com/Mario资格/百度3宝宝50593哦6的911946不
    [HTTPS://Gist.GitHub.Com/Mario zīgé/bǎidù 3 bǎobǎo 50593 ó 6 de 911946 bù]
    HTTPS://gist.GitHub.com/Mario qualifications / Baidu 3 oh baby 50 593 9119466 does not
  • 相关阅读:
    js实现input button从不可用变为可用
    eclipse工程名出现小红叉的解决办法
    jQuery的dataTables插件实现中文排序
    禁用鼠标选中DOM
    获取当前JS所在文件夹
    解决方案:在移动端输入框在软键盘弹出后位置矫正
    MUI版本升级更新程序IOS和andriod
    JavaScript输入表单数据正则验证规则
    Windows安裝PHP環境
    CentOS下安装PHP
  • 原文地址:https://www.cnblogs.com/metianzing/p/12512360.html
Copyright © 2020-2023  润新知