|
2 | 2 |
|
3 | 3 | ## Overview
|
4 | 4 |
|
5 |
| -Enteprise Managed Users (EMU) are a [feature of GitHub Enterprise Cloud](https://docs.github.com/en/enterprise-cloud@latest/admin/managing-iam/understanding-iam-for-enterprises/about-enterprise-managed-users) which provides a "walled garden" user account that cannot interact with public repositories on github.com, including filing issues, commenting on discussions, and raising pull requests. Large organizations use EMUs to provide a tighter degree of control over their user accounts, but this control can come at the cost of participation in open source communities. |
| 5 | +Enterprise Managed Users (EMU) are a [feature of GitHub Enterprise Cloud](https://docs.github.com/en/enterprise-cloud@latest/admin/managing-iam/understanding-iam-for-enterprises/about-enterprise-managed-users) which provides a "walled garden" user account that cannot interact with public repositories on github.com, including filing issues, commenting on discussions, and raising pull requests. Large organizations use EMUs to provide a tighter degree of control over their user accounts, but this control can come at the cost of participation in open source communities. |
6 | 6 |
|
7 | 7 | One of the goals of the Private Mirrors App is to enable contributions from EMUs, and this doc explains how to do it.
|
8 | 8 |
|
@@ -37,3 +37,48 @@ Here is an example of how the attribution flow works:
|
37 | 37 | 4. The Private Mirrors App automatically syncs the private mirror to the public fork.
|
38 | 38 | 5. The contribution is now visible in the public fork and is attributed to the user's public GitHub account.
|
39 | 39 | 6. The user can then switch to their public account and open a pull request from the public fork to the upstream repository, and the contribution will be properly attributed to their public identity.
|
| 40 | + |
| 41 | +### Automatically Configuring Git (Advanced) |
| 42 | + |
| 43 | +Git config supports a [conditional includes feature](https://git-scm.com/docs/git-config#_conditional_includes) to automatically include configuration conditionally based on metadata of the repository locally. Email, a [key for signing commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits), and other helpful settings can be configured automatically with this feature. It helps prevent mistakes from forgetting to configure settings within each repository. |
| 44 | + |
| 45 | +To configure conditional includes, start by creating a file in the same user directory where your `.gitconfig` is stored. Add the following content to the file: |
| 46 | + |
| 47 | +```ini |
| 48 | +[user] |
| 49 | + # replace this with your email address |
| 50 | + email = your-public-email@example.com |
| 51 | + # remove this option if not used |
| 52 | + signingKey = <signing key goes here> |
| 53 | +``` |
| 54 | + |
| 55 | +This file can be named anything, but for this example, we'll call it `.gitconfig-pma`. |
| 56 | + |
| 57 | +Then, add configuration to your `.gitconfig` to conditionally use the `.gitconfig-pma` file when in a repository used for contributions through PMA: |
| 58 | + |
| 59 | +```ini |
| 60 | +# Include config based on the remote HTTPS URL of the repository |
| 61 | +# Replace the github.com remote URL below with the remote URL used for private mirror contributions |
| 62 | +[includeIf "hasconfig:remote.*.url:https://github.com/**"] |
| 63 | + path = .gitconfig-pma |
| 64 | + |
| 65 | +# Include config based on the remote git URL of the repository |
| 66 | +# Replace the github.com remote URL below with the remote URL used for private mirror contributions |
| 67 | +[includeIf "hasconfig:remote.*.url:git@github.com*/**"] |
| 68 | + path = .gitconfig-pma |
| 69 | + |
| 70 | +# Include config based on directory in which the repository resides |
| 71 | +# Replace the **/pma/** directory example below with the directory used for private mirror contributions |
| 72 | +[includeIf "gitdir:**/pma/**/.git"] |
| 73 | + path = .gitconfig-pma |
| 74 | +``` |
| 75 | + |
| 76 | +Choose one or more of the above options, based on your needs; not all configuration approaches may be needed. |
| 77 | + |
| 78 | +With this configured, git should automatically set the user email and any other settings defined in the conditional config within matching repositories. You can verify the settings are applied by running `git config get <option>` in a repository used for contributions through PMA: |
| 79 | + |
| 80 | +```sh |
| 81 | +git config get user.email |
| 82 | +``` |
| 83 | + |
| 84 | +Review the [git config documentation on conditional includes](https://git-scm.com/docs/git-config#_conditional_includes) for additional information and examples. |
0 commit comments