Keeping a public and private version of my app using Git

I am building a Rails app that I manage with Git. All is perfect, but I’d like keep a public version as well as a private one. That is:

  • the public version is for a public repository (for people to use),
  • and the private version is for my own site.

The idea is that both versions should be up-to-date, with the difference that my private version’s files contain passwords for my site, and the public version doesn’t (or contains some default values as such).

  • How do I split up a large Git branch into lots of smaller branches?
  • fork git branches and see them with SmartGit
  • git-svn branch - How to keep branch in sync with trunk?
  • Git new branch is not a branch when using a previous commit
  • git merge with --no-ff and --squash
  • pull-only repo's 'git status' saying the branch is ahead of origin/master. Why?
  • I’ve been thinking of branches: master (the public version) and some private one.
    But it seems that I’d have to do a lot of merging after each commit.

    Please, bear in mind, that I am a asking for I am still quite a noob at git.

    Thanks folks!

  • Git submodule URL not including username?
  • Git Post Receive Hook: update current working branch to staging server
  • Can I get hg log to print the history in reverse order?
  • TeamCity's git checkout different from local git checkout
  • Order of git submodule foreach
  • Compare git branch with rebased branch
  • 2 Solutions collect form web for “Keeping a public and private version of my app using Git”

    I do Django development and keep all my sensitive data inside a single file which I put inside my .gitignore. It’s not version controlled and I keep separate versions of this on my deployment server and local dev machine.

    I would:

    • store the password in a private repo which contains only sensitive data
    • store in the public repo:
      • a reference to the private repo as a submodule (only you could checkout that submodule, since it is a private repo)
      • some template config
      • some script able to build the actual config file with the right value:
        • default value if there is no submodule
        • passwords if the submodule is checked-out.

    That way, no merge whatsoever, and no way to push sensitive data to a public repo.

    Git Baby is a git and github fan, let's start git clone.