How do you read git config values on a push remotely?
I have a centralized repository with a few developers pushing to it. I've installed ReviewBoard and I'd like to set up a hook to post each commit to review board so the peers can comment on it. I'd like this to be done automatically from the centralized repository. The best way I can tell to do this would be to set a custom config value of reviewboard.username.
I assume github does this, otherwise wouldn't it be pointless to have the user set github.user and github.token on your local copy? (http://help.github.com/set-your-user-name-email-and-github-token/)开发者_开发问答
How would I go about getting config values from the pusher on the centralized server in say, post-receive?
The github user and token are for identification purpose, when ssh isn't used.
As for pushing automatically to a repo B
when pushing to A
, consider adding to your repo an extra layer like Gitolite, especially since the recent 2.1 edition, with mirrors feature.
See the announce from today (Sep. 30th):
[ANNOUNCE] Gitolite v2.1 and mirroring features:
Almost as good as "active-active" mirroring:
If the "master" server trusts the authentication performed by the "slave" server, you can have the slave internally redirect a "git push" to the correct master.With this, developers don't have to remember which repo is mastered where, use different 'pushurl's, etc. They just do everything with their local mirror and let the system deal with it.
(You can even change which server is "master
" and people don't even need to know it has changed!)
You can't push custom or not config values to another repository with git.
Github has you put the token and user in your config for 3rd party apps running on your computer. So I suppose if you needed to get the config variables for a hook to do something, your options are either mirroring as VonC recommends where the admin is dealing with repository mirrors and syncing them back to master, or just suck it up and write your hook to run on the 'local client' repositories and have (and trust?) each developer to have them installed.
I've thought one option could be to have a separate repo with the hooks, maybe as a submodule, maybe not, and symlink them into .git/hooks/
精彩评论