Reducing the size of large git repository

The github repository of #NGSchool website has grown to over 5GB. I wanted to reduce the size & simplify this repository, but this task turned out to quite complicated. Instead, I have decided to leave current repo as is (and probably removed it soon) and start new repo for existing version. I could do that, as I don’t care about version earlier than the one I’m currently using. This is short how-to:

  1. Push all changes and remove .git folder
  2. [bash]
    git push origin master
    rm -rI .git
    [/bash]

  3. Rename existing repo
  4. Settings > Repository name > RENAME

  5. Start new repository using old repo name
  6. Don’t need to create any files as all already exists.

  7. Init your local repo and add new remote
  8. [bash]
    git init
    git remote add origin git@github.com:USER/REPO
    [/bash]

  9. Commit changes and push
  10. [bash]
    git add –all . && git commit -m "fresh" && git push origin master
    [/bash]

Doing so, my new repo size is below 1GB, which is much better compared to 5GB previously.