If you only want one config for your system, you could just configure it with git config --system
(as admin/root).
If you want to use the same config for multiple users (but not all users), you can create this config and a link to that config in the home directory of each user.
There is no possibility do that directly(at least I don't know any).
However, there are a few interresting things:
The command git config
has a --file option
. With this, you can configure seperate config files.
You can set the config file for you git config --local include.path "<config file>"
.
With that, you can create a new config file for your directory and when you create a directory, you can just set the config file of a directory using git config --local include.path "<config file>"
.
You can also automate that by writing a script, that automatically scannes all directories for e.g. a config file and executes git config --local include.path "<config file>"
if it finds any files.
That script could look like that(if you use linux/bash):
#!/bin/bash
git init
initDir="$PWD"
while [ "$PWD" != "/" -a ! -f "./.gitconfig" ] ; do
cd ..
done
if [[ -f "./.gitconfig" ]]; then
configFile="$PWD/.gitconfig"
cd $initDir
git config --local include.path "$configFile"
fi