简体   繁体   中英

how do I keep git config entries across pulls

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM