In my home directory I have files in a local git repository, because I want track them all under version control.
Most of these files I want to push to a remote repo
The way I eventually got around the issue is the following: Put the sensitive information in a sub directory with its own git repository and symlink the file(s) back to the old location.
E.g. in your home folder (~
) lives the file .creds
which you do not want in the public repository. Move this file in a sub folder called, say protected
and create a symlink from ~
to protected/.creds.
Of course, do not include this folder in your ~
repository , but create a new repository in the folder protected
just to keep track of .creds
. If you do not push this repository publicly at all, you are set.
I know this solution is kind of a cop out: My questions states that the file resides in the same directory, but the symlinking works for me.