I'd say it's not a good idea to outright delete them.
I'm wondering why there is a .git directory in the release path when I
use S3 deployment, not git deployment.
The Chef deploy resource doesn't have an option to deploy from a zip (as oppose to from version control). To get around that OpsWorks downloads the zip and initializes a Git repository in it, then runs deploy on that.
When I checked the release path inside the
/srv/www/app/release/release_paths
Did you mean releases/<some date>
or shared/cached-copy
? I don't think release
is a standard directory in the default Chef deploy directory layout.
Can I safely remove the .git directory on the deployment hook to free
some space?
If you mean releases/<some date>
then no. This is used for the rollback command, allowing you to revert back to one of those previous versions.
If you really need the space the default number of versions to keep is 5, but you could reduce this by overriding the [:opsworks][:deploy_keep_releases] attribute.