Reputation: 28757
My company uses gerrit and we have many repositories. Every time a new repository is cloned, we need to manually add the push = HEAD:refs/for/master
line to our git config. Is there any way to configure our projects so this line gets added automatically when the project is cloned?
Similarly, it would be nice to ensure that createchangeid = true
is added so that it doesn't need to be in the user's global config.
Upvotes: 1
Views: 320
Reputation: 489083
Tell people to use your script to clone, where your script reads, e.g.:
#! /bin/sh -e
git clone "$@"
[insert all the git config commands you like here]
Make sure this script is executable (chmod +x
).
The usage of this script will be the same as the usage of git clone
. If you do write such a script and install it somewhere so that your users' $PATH
will find it, and if you name this script git-xyzzy
, they can run git xyzzy <clone-arguments>
and that will run this script, as if it were a standard part of Git (though obviously, since you wrote it yourself, it's not).
Upvotes: 1