Last Updated: February 25, 2016
·
423
· buchin

Delete All .git Files Under Directory

Your hosting low on disk space, when you find the culprit, it was files under .git folders.

So if you don't need the git files anymore here is how to clean up.

Login to your server's shell, and then write:

find . | grep .git | xargs rm -rf

That should do the work and and we can gain more free space.

2 Responses
Add your response

Another one using only find:

find <path_where> -type d -name '.git' -exec rm -rf {} \;
over 1 year ago ·

You forgot the asterisk :

-name "*.git"</code></pre>

You can even use the -delete option:

find <path_where> -type d -name '*.git' -delete</code></pre>
over 1 year ago ·