Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
git:generic-settings [2008/11/20 14:41] miconda created |
git:generic-settings [2010/01/12 22:02] (current) linulin no spam |
||
---|---|---|---|
Line 4: | Line 4: | ||
===== Mail Notifications ===== | ===== Mail Notifications ===== | ||
- | The central git repository can send email notifications whenever a contributor pushes commits into it. The mailing script is in $GIT_REPO/ | + | The central git repository can send email notifications whenever a |
+ | contributor pushes commits into it. The mailing script is in | ||
+ | $GIT_REPO/ | ||
+ | notifications can be configured from the repository. To enable mail | ||
+ | notifications you have to set mailNotifications to true in the hooks | ||
+ | section: | ||
< | < | ||
Line 11: | Line 16: | ||
</ | </ | ||
- | After that you need to configure the sender and recipient email addresses and a link to gitweb. These parameters belong to section mail: | + | After that you need to configure the sender and recipient email |
+ | addresses and a link to gitweb. These parameters belong to section | ||
+ | mail: | ||
< | < | ||
Line 20: | Line 27: | ||
</ | </ | ||
- | Parameter | + | Parameter '' |
+ | in the message envelope. This is the email address that will receive | ||
+ | delivery status notification and notifications of failures. This is | ||
+ | not the email address that will be put in From header, the From header | ||
+ | will be set to your name and email address which you configured in git | ||
+ | and which appears in the commits. | ||
- | Parameter | + | Parameter '' |
+ | development mailing list. Mail notifications can contain a link to | ||
+ | gitweb in the body, configure '' | ||
+ | gitweb if you want to have a link to gitweb in your email | ||
+ | notifications. | ||
- | The mapping of usernames to email addresses is done using a static file. The original commitlog script used a static address in From. I then modified the script to extract the author information from the commit object so that we can use it in From and people can reply to commitlog messages directly -- reaching the author of the change. Unfortunately this did not work as I expected. A contributor might pull some changes from a private repository for somebody else and then the email address of that person would be in the author field and in From header of the commitlog, although the commit was done by somebody else. Then we tried to use the committer field from the commit object, but the result was the same, most of the time it contains the same email address as the author field. | + | The mapping of usernames to email addresses is done using a static |
+ | file. The original commitlog script used a static address in From. I | ||
+ | then modified the script to extract the author information from the | ||
+ | commit object so that we can use it in From and people can reply to | ||
+ | commitlog messages directly -- reaching the author of the | ||
+ | change. Unfortunately this did not work as I expected. A contributor | ||
+ | might pull some changes from a private repository for somebody else | ||
+ | and then the email address of that person would be in the author field | ||
+ | and in From header of the commitlog, although the commit was done by | ||
+ | somebody else. Then we tried to use the committer field from the | ||
+ | commit object, but the result was the same, most of the time it | ||
+ | contains the same email address as the author field. | ||
- | It turned out that we couldn\'t use GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL environment variables in people\'s ~/.bashrc either to be used in From, because git executes the shell as non-interactive and non-login so the startup files are ignored when git executes commands and hooks on the server. | + | It turned out that we couldn' |
+ | GIT_COMMITTER_EMAIL environment variables in people' | ||
+ | either to be used in From, because git executes the shell as | ||
+ | non-interactive and non-login so the startup files are ignored when | ||
+ | git executes commands and hooks on the server. | ||
So I ended up adding a simple mapping file, it is in $GIT_DIR/ | So I ended up adding a simple mapping file, it is in $GIT_DIR/ | ||
- | format is \"username=First Last < | + | format is |
+ | < | ||
+ | username=First Last < | ||
+ | </ | ||
+ | |||
+ | You can define a catch-all rule in the mapping file which will be used | ||
+ | whenever no matching username can be find if you replace the username | ||
+ | with *: | ||
- | You can define a catch-all rule in the mapping file which will be used whenever no matching username can be find if you replace the username with *: | ||
< | < | ||
*=root@localhost | *=root@localhost | ||
</ | </ | ||
- | and I added a new configuration option to the git config where you can specify with mapping file will be used for the repository: | + | and I added a new configuration option to the git config where you can |
+ | specify with mapping file will be used for the repository: | ||
< | < | ||
Line 47: | Line 85: | ||
</ | </ | ||
- | The mailing script dies if it cannot translate a username to email address. It is also possible specify a static From address in the git confiuration file, i.e: | + | The mailing script dies if it cannot translate a username to email |
+ | address. It is also possible specify a static From address in the git | ||
+ | confiuration file, i.e: | ||
< | < | ||
Line 54: | Line 94: | ||
</ | </ | ||
- | Then the static configuration takes precedence. Two more improvements to come are: | + | Then the static configuration takes precedence. Two more improvements |
+ | to come are: | ||
* Update the cvs synchronization script so that we get notifications of commits from cvs. | * Update the cvs synchronization script so that we get notifications of commits from cvs. | ||
Line 61: | Line 102: | ||
===== Branch ACLs ===== | ===== Branch ACLs ===== | ||
- | Write access to specific branches can be limited. This is implemented in the update hook. | + | Write access to specific branches can be limited. This is implemented |
- | There are 2 files that control who can commit and on which branch: | + | in the update hook. There are 2 files that control who can commit and |
+ | on which branch: | ||
| | ||
- | | + | |
they are written in the file and they stop at the first match. If the username matches one of the user patterns on the first line matching the branch it will be allowed to commit, else if the branch matched it will be denied and if no branch pattern matched it depends on the **acl.defaultPolicy** config variable. | they are written in the file and they stop at the first match. If the username matches one of the user patterns on the first line matching the branch it will be allowed to commit, else if the branch matched it will be denied and if no branch pattern matched it depends on the **acl.defaultPolicy** config variable. | ||
< | < | ||
Line 70: | Line 112: | ||
# Format: branch_pattern user_pattern_list | # Format: branch_pattern user_pattern_list | ||
# All the patterns are regular expressions, | # All the patterns are regular expressions, | ||
- | # A branch patter starting with a \'+\' has a special meaning: on that branch | + | # A branch patter starting with a ' |
# non-fast-forwards are allowed. | # non-fast-forwards are allowed. | ||
# The pattern evaluation stops on first match (so all user allowed to commit | # The pattern evaluation stops on first match (so all user allowed to commit | ||
Line 88: | Line 130: | ||
</ | </ | ||
- | * **$GIT_DIR/ | + | * **$GIT_DIR/ |
was found in **$GIT_DIR/ | was found in **$GIT_DIR/ | ||
Config options: | Config options: | ||
- | * **acl.defaultPolicy** : if set to \"allow\" and no rules match the branchname in the allowed-user or allowed-group files, the commit will be allowed. If set to any other value, it will be denied. | + | * **acl.defaultPolicy** : if set to " |
- | * **acl.usernameBranches** : is set to \"allow\" commits to branches of the form ${username}/ | + | * **acl.usernameBranches** : is set to " |
is not explicitely allowed in the allowed-user file. | is not explicitely allowed in the allowed-user file. | ||
Line 105: | Line 147: | ||
===== Changelog ===== | ===== Changelog ===== | ||
- | * \'\' | + | * '' |
- | * \'\' | + | * '' |
- | * \'\' | + | * '' |
- | * \'\' | + | * '' |
- | * \'\' | + | * '' |
- | * \'\' | + | * '' |
- | * \'\' | + | * '' |
- | * \'\' | + | * '' |
- | * \'\' | + | * '' |
===== Remember ===== | ===== Remember ===== | ||
- | * When setting up a repository that should be available through HTTP (i.e. dumb server), it is necessary to do \'\'chmod +x repository/ | + | * When setting up a repository that should be available through HTTP (i.e. dumb server), it is necessary to do '' |
- | * Run \'\' | + | * Run '' |