Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I'm fine with the source code to my files being public, but I obviously don't want my passwords/login info/etc to be public.

How can I host the repo with GitHub publicly but keep myself safe?

share|improve this question
up vote 7 down vote accepted

Generally, all config data like passwords and database info will be kept in a config file. To keep private data safe, I usually:

  • Create an example config file that is hosted with the project
  • Provide documentation on modifying the example to be the actual config (rename the file, replace variables, etc.)
  • Add the actual config file to .gitignore so that it is not a tracked file

Those are my thoughts ...

share|improve this answer

You have at least two ways:

  • Don't use Git, here such obvious task is problem, and move to Mercurial with MQ, in which you store in public place any scrap, replaced in local workplace by actual data (local MQ-patches)
  • Read about smudge/clean filters and store in repository template-snippets, expanded automagicaly to real data in Working Directory
share|improve this answer
If the question implies using git, the not using git isn't an answer. – Steve Robbins Dec 12 '12 at 17:48
@SteveRobbins - I wrote "You have at least two ways...", BTW. Templating and handwork is old style, filters - Git-way, JFYI – Lazy Badger Dec 12 '12 at 19:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.