Cách di chuyển dự án GitLabCE sang GitHub – How to migrate project GitLabCE to GitHub


migrate project A GitLabCE to project B GitHub

  1. Inside your GitHub team page, create an empty private repo with the same name of GitLab repo that you want to transfer.
    git clone https://gitlab.hotromaytinhit.tech/hotromaytinhit/A.git
  2. Copy your newly created repo link, either in HTTPS or SSH. For example, https://github.com/hotromaytinhit/B.git (SSH type)
  3. Inside your local project folder, change the remote URL under .git/config ‘s file to your copied GitHub’s one. The content looks similar as follows. [remote “origin”]
    cd A
    vim .git/config & change url project B github
    url = https://github.com/hotromaytinhit/B.git
    fetch = +refs/heads/:refs/remotes/origin/
  4. Do a git push: git push –all . It will push all codes and commit history on your newly GitHub repository.
  5. Done. After that, when we push new commits, it will push to GitHub only.

  1. Assume we are in your home directory
    cd /home/hotromaytinhit
  2. Clone the repo from GitLab using the --mirror option
    git clone –mirror https://gitlab.hotromaytinhit.tech/hotromaytinhit/A.git
  3. Change into newly created repo directory
    cd /home/hotromaytinhit/A.git
  4. Push to GitHub using the --mirror option. The --no-verify option skips any hooks.
    git push –no-verify –mirror https://github.com/hotromaytinhit/B.git
  5. Set push URL to the mirror location
    git remote set-url –push origin https://github.com/hotromaytinhit/B.git
  6. To periodically update the repo on GitHub with what you have in GitLab
    git fetch -p origin
    git push –no-verify –mirror