1

I have a git repo and I'd like to set a config entry so that anyone who pulls gets that config entry.

The specifics are that I have a sqlite3 database in the repo, and I'd like to configure git diff to show text versions of the database.

I have a .gitattributes file in the repo that makes git use the diff "sqlite3":

*.sqlite3 diff=sqlite3

but the sqlite3 diff needs to be defined in a git config section, like so:

[diff "sqlite3"]
    binary = true
    textconv = "echo .dump | sqlite3"

Currently I have tried putting it in the .git/config file, but it is not defined when pulling from this repo.

A workaround is to put it in the .git/config or ~/.gitconfig of each user, but I'd like it to be automatic.

Brian Minton
  • 3,377
  • 3
  • 35
  • 41
  • Possible duplicate: http://stackoverflow.com/questions/2333424/distributing-git-configuration-with-the-code – Sascha Wolf Jun 18 '14 at 14:17
  • the answer to that question doesn't address the fundamental question of of distributing git configuration. That question mentions using a `.gitattributes` file, which I also mentioned in my question, but does not discuss `.git/config` (even though that was what was asked). – Brian Minton Jun 18 '14 at 15:53

1 Answers1

2

If those users have access to a common shared folder, you can take advantage of a template directory use in git init --template=....

That template directory can contain a config file which would be copied during the initialization of the repo by a user.

Other than that, a config isn't shared between repos instances.


The alternative is to version a script which can execute the appropriate git config commands you want your users to run.
And have a README explicit enough to clearly indicate the users of your rpeo they should run said script.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250