I'd like to keep my git repo as clean as possible without cache files and content image files. Also I'd like to preserve the ExpressionEngine images directory structure. What are you gitignore directives to achieve this?
If you want the directories to still get created, you need to have something in them, so I make sure there is an index.html file in each of the EE image directories that says "Directory Access not allowed" (or similar). Then, for each of the directories you can add rules like the following (your paths may vary):
/assets/images/captchas/* !/assets/images/captchas/index.html /assets/images/member_photos/* !/assets/images/member_photos/index.html # and so on...
That will ignore all the items in those directories except the index.html, so when you clone the site, at least the directory structure will be preserved, but none of the images will come with.
The github/gitignore repo is usually a good starting place for gitignore defaults, and I think it is in this case as well:
.DS_Store # Images images/avatars/ images/captchas/ images/smileys/ images/member_photos/ images/signature_attachments/ images/pm_attachments/ # Caches sized/ thumbs/ _thumbs/ */expressionengine/cache/*
Your paths may vary:
# Global Files !.gitignore .htaccess .sass-cache # .svn .DS_Store config.local.php config.dev.php [Tt]humbs.db # Images src/www/public_html/assets/ee_images/* # src/www/public_html/assets/ee_images/avatars/ # src/www/public_html/assets/ee_images/captchas/ # src/www/public_html/assets/ee_images/smileys/ # src/www/public_html/assets/ee_images/member_photos/ # src/www/public_html/assets/ee_images/signature_attachments/ # src/www/public_html/assets/ee_images/pm_attachments/ # UGC src/www/public_html/assets/uploads/* # Caches sized/ thumbs/ _thumbs/ cache/