Reduce Github repo size of a bookdown project

I have a project called edav.info/, which is published using bookdown. A lot of students have helped contribute to the resource using github pull requests. After a while, I noticed the github folder had gotten very large (~700MB) even though all our resource files are not much bigger than 70MB. I found that our .git folder was the culprit, keeping track of the history of the project for us.

I think the large .git size is a result of running the bookdown::render_book command over and over, which generates a lot of new files each time it is called. I'm wondering about two things:

1. How can I reduce the size of our repo (remove the temporary render files from history)?
2. Can I prevent the .git folder from clogging up in the future?

Currently all of the bookdown files and the _book folder it generates are all included in the .gitignore, but I'm not sure if that's enough. I'd be interested in hearing from anyone who has a similar resource created using bookdown in how you have gotten around the large .git folder problem.

Here's a link to the repo and the resource:

Much appreciated.

Zach

1 Like

Physician, heal thyself. Looking at the stats, your username accounts by far for most of the activity. I'm not a git maven, but perhaps if you did more of your work in a branch, rather than the master, it might cut down on the number of entries in the history file? Just a hunch.

You should start with seeing what exactly takes so much space and then you can remove all/some of the files that ended up in .git. There is this tool -- https://rtyley.github.io/bfg-repo-cleaner/ -- that makes both of those tasks quite easy. I've used it for couple of github repos and it was fast and not at all painful.

3 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.