I have my dot files in Github publicly.
This means that I have only a few files at my Home shared with others.
The disadvantage of sharing, for instance, .bashrc with others is that I need to be careful not adding confidential data to Github.
I run
git status
I get a long list of untracked files.
I found out that apparently the only way to get rid of them them is by running
git clean -df
This would remove my private files which I do not want to.
How can you remove my private files from Git's status without removing my private files at my Home?
You can ask Git to ignore given untracked files using gitignore mechanism:
.gitignore
file in current directory.gitignore
file in top directory of your repositoryinfo/exclude
file in $GIT_DIR (in .git
repository database)core.excludesFile
config variable to e.g. "/home/user/.gitignore"For your situation it would be probably best to use '.git/info/exclude', because this way name of ignored file would be not visible to others, contrary to the situation where you accidentally commit .gitignore
file, or you are forced to have it in repository. Usually .gitignore
(versioned and distributed) is about ignoring e.g. generated files, while info/exclude
(or code.excludesFile
) is about ignoring site-specific files, like backup files of your editor.