Skip to content

Instantly share code, notes, and snippets.

@dangreene0
Last active June 24, 2022 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dangreene0/c49040df542be9882aae538af1345649 to your computer and use it in GitHub Desktop.
Save dangreene0/c49040df542be9882aae538af1345649 to your computer and use it in GitHub Desktop.
How to clean up Repo file size to migrate from GitLab to GitHub

How to migrate a Repo from GitLab to GitHub

Remove all files about 100MB

Following close to these steps and borrowing some of these

You must use BFG Repo-Cleaner to meet GitHub's file size requirements. Download BFG Repo-Cleaner into the same directory of where you're gonna clone your repos in this process.

git clone --mirror https://gitlab.com/gluser/your-original-repo.git

Rename the bfg .jar file to bfg.jar. It's easier to type it thise way.

cd your-original-repo.git
git reflog expire --expire=now --all
git gc --prune=now --aggressive

The gc command should take some time

Instead of pushing the repo back to GitLab Push the mirror to GitHub!

git push --mirror https://github.com/ghuser/your-new-repo.git

THIS WILL LOOK LIKE IT'S NOT DOING ANYTHING LEAVE IT ALONE FOR A FEW MINUTES

When you're done the repo should now be on GitHub!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment