Making a Git project open source when you have secret keys
I have a project on GitHub behind a private repository. I want to make the repo public. However, my project uses secret keys.
How can I make the project public while still protecting the "history" of those secret keys? I'm guessing I'm SOL, and should simply invalidate the keys to prevent their use.
Note that this is not the same question as How to open-source an application that uses API keys
or
How to handle 'open-sourcing' your application, when it uses a personal API key?
As my project is already on Git, the entire source history can be easily viewed. What I suppose I could do is branch off a separate project with 开发者_运维知识库the API keys hidden, and make that repo public. But then users would miss out on the entire branching history, which they may be curious about (I know I would).
You could remove the secret keys from the repository using a hammer like git filter-branch
. There is a nice explanation on GitHub's help pages.
I used a new .gitignore which already excluded all the private stuff/secret keys and copied everything into a fresh repository. If I ever need access again to the old git history, I have left a copy of it.
Check out git-castle
(https://www.npmjs.com/package/git-castle)!
You can add contributors to your whitelist and allow them to use your keys.
精彩评论