I would like to stop/prevent users to commit a file with sensitive data into a remote repository (GitHub). It is a C/C++ project, but the role of this file is like an .env
file. My idea was to provide this file in an initial commit with the different available variables without any value assigned and allow the users to fill them with their personal/sensitive data and avoid its commit.
What I did was to add the file to the .gitignore
and then to perform a git add -f
of this file, but after that the file is tracked. And I don't want to remove it from the remote repo (git rm --cached
), I just want to avoid them to commit changes on it.
To be clear, this project is for my students, so we can't expect to add files to the stage area individually (git add -A
is the norm...) and git update-index --skip-worktree
is not an option since is a client action (not like a .gitignore
rule, which is pulled from the repo and is transparent for them).
Any idea?
Thank you very much in advance