Reputation: 638
I share my Java project on GitHub (because I believe in open-source code and no hidden tricks). Anyways, I have a unique UserAgent I got from a website for API usages... I want to know how I can hide that from GitHub without making my project private... What can I do? I tried searching Google, but no one seems to have the same problem. I can't use a separate file and then add it to .gitignore because it won't work when I deploy the project. Please help!
Upvotes: 4
Views: 2013
Reputation: 3315
Just encrypt confidential info using GPG and also sign your tags.
Upvotes: 0
Reputation: 1323653
I want to know how I can hide that from GitHub without making my project private
You cannot push that information to the repo then.
What you can do is declaring a content filter driver which, on checkout, will check if it has access to a private source of information (elsewhere than your public repo, potentially elsewhere than GitHub), and generate the right file (which remains private, and is declared in the .gitignore).
That content filter driver is declared in a .gitattributes, and is taking a template file (which is versioned but contains, by its nature, no value), and will generate the complete file with:
Upvotes: 2
Reputation: 14599
As suggested in comments: put this information in a config file.
Here is an example: this javascript project provides a config.js.template file, but the application expects a config.js
file (which is gitignored). If this file doesn't exist, the template is copied.
That way, it will run with sensible default values even if the user doesn't take the time to write his own config first.
Moreover, since you're saying yo plan to "switch" to a config file, I guess those personal config values are currently in your code. So don't forget to also clean your old commits before pushing to github!
Upvotes: 1