我们经常发布文档更新,此页面的翻译可能仍在进行中。有关最新信息,请访问英文文档。如果此页面上的翻译有问题,请告诉我们

此版本的 GitHub Enterprise 已停止服务 2020-11-12. 即使针对重大安全问题,也不会发布补丁。 要获得更好的性能、改进的安全性和新功能,请升级到 GitHub Enterprise 的最新版本。 如需升级方面的帮助,请联系 GitHub Enterprise 支持

Creating a GitHub App

您可以在您的个人帐户下或在您有管理权限的任何组织下创建和注册 GitHub 应用程序。

  1. 在任何页面的右上角,单击您的个人资料照片,然后单击 Settings(设置)

    用户栏中的 Settings 图标

  2. 在左侧边栏中,单击 Developer settings

    Developer settings 部分

  3. 在左侧边栏中,单击 GitHub Apps(GitHub 应用程序)

    GitHub Apps 部分

  4. Click New GitHub App.

    Button to create a new GitHub App

  5. In "GitHub App name", type the name of your app.

    Field for the name of your GitHub App

    Give your app a clear and succinct name. Your app cannot have the same name as an existing GitHub user, unless it is your own user or organization name. A slugged version of your app's name will be shown in the user interface when your integration takes an action.

  6. Optionally, in "Description", type a description of your app that users will see.

    Field for a description of your GitHub App

  7. In "Homepage URL", type the full URL to your app's website.

    Field for the homepage URL of your GitHub App

  8. In "User authorization callback URL", type the full URL to redirect to after a user authorizes an installation. This URL is used if your app needs to identify and authorize user-to-server requests.

    Field for the user authorization callback URL of your GitHub App

  1. If your app authorizes users using the OAuth flow, you can select Request user authorization (OAuth) during installation to allow people to authorize the app when they install it, saving a step. If you select this option, the "Setup URL" becomes unavailable and users will be redirected to your "User authorization callback URL" after installing the app. See "Authorizing users during installation" for more information.

    Request user authorization during installation

  2. If additional setup is required after installation, add a "Setup URL" to redirect users to after they install your app.

    Field for the setup URL of your GitHub App

    Note: When you select Request user authorization (OAuth) during installation in the previous step, this field becomes unavailable and people will be redirected to the "User authorization callback URL" after installing the app.

  3. In "Webhook URL", type the URL that events will POST to. Each app receives its own webhook which will notify you every time the app is installed or modified, as well as any other events the app subscribes to.

    Field for the webhook URL of your GitHub App

  4. Optionally, in "Webhook Secret", type an optional secret token used to secure your webhooks.

    Field to add a secret token for your webhook

    Note: We highly recommend that you set a secret token. 更多信息请参阅“保护 web 挂钩”。

  5. In "Permissions", choose the permissions your app will request. For each type of permission, use the drop-down menu and click Read-only, Read & write, or No access.

    Various permissions for your GitHub App

  6. In "Subscribe to events", choose whether to subscribe your app to Label, Public, Repository, or Watch events.

    Subscribe to events options for your GitHub App

  7. To choose where the app can be installed, select either Only on this account or Any account. For more information on installation options, see "Making a GitHub App public or private."

    Installation options for your GitHub App

  8. Click Create GitHub App.

    Button to create your GitHub App