zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    Java8-Stream-No.10
    Java8-Stream-No.09
    Java8-Stream-No.08
    Java8-Stream-No.07
    Java8-Stream-No.06
    Java8-Stream-No.05
    Java8-Stream-No.04
    Java8-Stream-No.03
    Java8-Stream-No.02
    Java8-Stream-No.01
  • 原文地址:https://www.cnblogs.com/metianzing/p/12512360.html
Copyright © 2011-2022 走看看