I am trying to implement a new backup system on a website using git. The virtual private server has 20GB space total with 5GB free.
When I run git add . at the /var/www (with my favorite .gitignore parameters) I have a gigantic git folder that fills my hard drive to capacity.
It is not immediately apparent as to why this is happening as I expect the .git directory to contain the bits about the bits (meta information) and not binary duplicates of all my files!
Whats going on here? If my website is 14GB will the .git directory occupy an additional 14 gb?
Space Used Equals GIT_DIR + GIT_WORK_TREE
To oversimplify the case enormously, yes. In a non-bare respository, Git stores all tracked file blobs, as well as other repository objects such as trees and commits under GIT_DIR. It also maintains copies in the GIT_WORK_TREE.
The repository uses packfiles and deltification to keep this state of affairs from getting out of hand in the normal use case, but if you have 14GB+ of data in a non-bare respository–especially if a lot of those files are binary assets–then you may very well double-up (or worse) on disk usage.