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

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

安装 GitHub 应用程序

当您的应用程序为公共时,任何人都可以通过 安装 URL 将您的应用程序安装在他们的仓库中。 当您的应用程序为私有时,您只能将该应用程序安装在您自己的仓库中。

本文内容

注:您的 GitHub 应用程序 将有权访问应用程序创建的任何仓库,即使用户只在选定的仓库中安装您的应用程序。

在您的仓库中安装您的私有 GitHub 应用程序

创建私有 GitHub 应用程序后,您可以将其安装在您的某个组织或用户仓库中。 更多信息请参阅“私有安装流程”。

  1. GitHub 应用程序设置页面,选择您的应用程序。
  2. 在左边栏中,单击 Install App(安装应用程序)
  3. 单击包含适当仓库的组织或用户帐户旁边的 Install(安装)
  4. 将应用程序安装在所有仓库或所选仓库中。
    App installation permissions
  5. 安装后,您将在所选帐户上看到应用程序的配置选项。 您可以在这里进行更改,或重复前面的步骤将应用程序安装到其他帐户上。

Allowing people to install your public app on their repository

You can enable others to install your public app by providing the installation URL in places like your app's homepage. You can then point to your app's homepage from the landing page on GitHub.

If you are migrating from an OAuth App to a GitHub App, you can use query parameters to preselect the repositories and account when installing the GitHub App. See "Migrating OAuth Apps to GitHub Apps" to learn more.

These steps assume you have built a GitHub 应用程序:

  1. From the GitHub Apps settings page, select the public app you want to configure for others to install.
  2. In "Homepage URL," type the URL for your app's homepage and click Save changes.
    Homepage URL
  3. GitHub provides a landing page for your app that includes a link to your app's "Homepage URL." To visit the landing page on GitHub, copy the URL from "Public link" and paste it into a browser.
    Public link
  4. Create a homepage for your app that includes the app installation URL: http(s)://[hostname]/apps/<app name>/installations/new.

Authorizing users during installation

You can simplify the authorization process by completing it during app installation. To do this, select Request user authorization (OAuth) during installation when creating or modifying your app in GitHub. See "Creating a GitHub App" to learn more.

Once someone has installed your app, you will need to get an access token for the user. See steps 2 and 3 in "Identifying users on your site" to learn more.

Preserving an application state during installation

You can provide a state parameter in an app's installation URL to preserve the state of the application page and return people back to that state after they install, authenticate, or accept updates to your GitHub App. For example, you could use the state to correlate an installation to a user or account.

To preserve a state, add it to the installation URL:

http(s)://[hostname]/apps/<app name>/installations/new?state=AB12t

此文档对您有帮助吗?

Privacy policy

帮助我们创建出色的文档!

所有 GitHub 文档都是开源的。看到错误或不清楚的内容了吗?提交拉取请求。

做出贡献

或, 了解如何参与。