Simply add the directry name into .gitignore files. Example as shown below:
All these files is sitting in .gitignore file
node_modules
bower_components
config-dev.json
.cache
npm-run-pull.php
property-profile-report-pdf/reports/*
home/*.json
sites/all/themes/assets/css/style.css
.DS_Store