2

I'm just getting started with Git.
I've got:

  • a repository on my local machine for web development /www/my-web-app/ and
  • on a remote server I have a bare repository /www/git-repo/ and then the actual web app /www/production-my-web-app/.

I'm currently pushing from my local machine to the bare repository and then pulling that in the production repository.

The issue is I have a couple of config files that are different in production.
I have them ignored but I can't figure out a way to upload them (can't do it via FTP for some reason) and I'm sure I'm just missing an obvious facility of git.

Any help is appreciated, thanks!

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Dormouse
  • 5,130
  • 1
  • 26
  • 42
  • What is git supposed to do? So you want to have these config files in a git repository - but they should not be versioned? Or do you just want to keep them separate from the application repository? In the latter case you could store them in another git repo (dev and production) and import them as submodules in your dev and production environment. – madflow Jan 03 '12 at 14:37
  • Submodules would probably be overkill, there's no need to version as the few files will always be constant. – Dormouse Jan 03 '12 at 14:43
  • Why do you `pull` for your prod application? Why don't you use `git archive`? – fge Jan 03 '12 at 14:44

1 Answers1

2

The feature you might have missed and should help in your case is the "content filter driver", especially the smudge step.

content filter driver

The idea is to version a:

  • template of your config file
  • a script (smudge) able to take the template and generate a private (ie non-versioned) config file
  • some non-production values (used by the script when called from your local machine)

That way, that same smudge script will use external values when used in a production environment, that is secret values not stored in a git repo (no danger for them to be cloned/pushed around).
As opposed to your local machine where those test values can be safely versioned in a Git repo.

If there is no "secret data" issue, you can simply version several "config value" files, one per environment, leaving it to your smudge script to:

  • detect in what environment it is being called (automatically during the git checkout)
  • use the right "config value" script to generate the proper config file.
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250