We can always use the .gitignore to exclude files which we do not want to check in into the repository. But sometimes the repository is only read only and you dun want your files to be appeared in the git status command. A simple solution to exclude those files in your current working copy. This could be done by editing the .git/info/exclude. Here is an example for my Drupal 8 installation.
# git ls-files --others --exclude-from=.git/info/exclude # Lines that start with '#' are comments. # For a project mostly in C, the following would be a good set of # exclude patterns (uncomment them if you want to use them): # *.[oa] # *~ sites/default/files sites/default/files/* sites/default/settings.php
Reference: StackOverflow – Is there an ignore command for git like there is for svn?