How can I extract out sensitive information when pushing to a git repository?
I have a function that I call somewhere within my classes that looks like this:
RLP.Unlock("User ID", new byte[] { ... });
The data is per-user information provided by the hardware manufacturers, which essentially says that whatever you use the feature for is not their problem. But I digress.
Recently, I accidentally committed code with this line to a public GIT repository. Th开发者_高级运维is doesn't concern me enough to rewrite the history, but I'd be interested to know how I can pull this section of code out from the rest so that it doesn't appear in future commits.
To be clear, I'm looking for a way of storing the two sensitive pieces of data somewhere other than in this class, so that I can add them to git-ignore, while still sharing the rest of the class.
I would recommend that you factor this data out into a separate datafile provided as input to the application, then track that one datafile in a separate git repository. Git itself is not designed for masking out parts of a repository, and all kinds of madness will result if you try to force things to work that way.
精彩评论