Migrate Bitbucket Repo to Github consisting of Large Files

If you are looking to migrate your bitbucket repo into github, and if the original repo contains large files you will encounter the following error.

GH001: Large files detected. You may want to try Git Large File Storage

Deleting the large files and committing it won’t work since the large files are already there in your previous commits. Here are the commands you can run to completely remove all the large files

CD into your bitbucket repo and run following command

git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch FOLDERNAME" -- --all

replace FOLDERNAME with the file or folder you wish to remove from the given git repository.

Once this is done run the following commands to clean up the local repository:


rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now

Now push all the changes to the remote repository:

git push --all --force

This will clean up the remote repository

Source: https://stackoverflow.com/a/43640996

Related Articles

Site Footer