Search code examples
gitgithubgitlabgithub-enterprise

Unable to change git (Enterprise) remote url without git trying to push un-tracked directory


I need a repository hosted on GitLab to also be hosted on a GitHub Enterprise server. The server prevents files from over 100MB be uploaded.

I had a local Mongo database with two "prealloc" files that put aside 1GB each. I deleted the parent (data/) directory (now using MLab to host database), and stopped git tracking with git rm data/. I then do

git remote set-url origin [email protected]

This sets the origin url to be the enterprise version. Then when I try and push, it aborts the push along with the message:

remote: error: File data/journal/prealloc.0 is 1024.00 MB; this exceeds GitHub Enterprise's file size limit of 100.00 MB

Even though the directory has gone. Its not in git's list of tracked files. Any ideas on what I might be missing?


Solution

  • Even though the directory has gone. Its not in git's list of tracked files. Any ideas on what I might be missing?

    • First of all, you still have it in your history.
    • Second, verify that it is removed: git rm -rf --cached data/ This will delete it from staging and you will have to commit the deletion.
    • 3rd Clean up your repo with the BFG tool https://rtyley.github.io/bfg-repo-cleaner/