On Wed, 2 Nov 2016 01:06:07 -0700 (PDT)
[email protected] wrote:

> Let's say I have a local git server and a remote service such as 
> Bitbucket/Github/Gitlab etc.
> 
> Let's say I've got a few files in the repository holding sensitive 
> information (e.g. "config" files containing passwords etc.)
> 
> Is there a way to do a selective push to the remote service ? (i.e. a
> sort of .gitignore type thing, but not gitignore because the config
> files should still be commited to the local repository to enable dev
> testing).

Git can't do that, conceptually, simply because the core idea of
distributed VC systems is exchanging data in a way to have identical
history records contained in them.  To implement this idea, the minimal
unit of history is a commit, which refers to a snapshot of the whole
project, and is identified by a cryptographic hash calculated over the
contents of that whole snapshot.  This means that if you change at
least a single bit of any file comprising that snapshot, that
cryptographic hash will change as well.  Consequently, if you send a
commit identified by such and such hash value to another repository, you
_have to_ make sure you also send all the corresponding data as is.

OK, that was explaining the background theory.

In practice, there are several approaches to tackle your problem.
Magnus explained two good approaches to do that -- a local commit or a
series of commits containing only the configuration changes, which
never gets pushed but is rather gets rebased as the development on its
"base" branch progresses, and using of clean/smudge filters, -- but I'd
like to propose a simpler solution which exists since ages: just don't
keep configuration in the repository at all.  You seem to mix
deployment with version controlling; these are closely related things
but they are still different activities.  Say, if your software uses
textual configuration files, keep their _templates_ in the repository,
and require manual rollout of the real configuration files from these
templates before deployment.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to