Skip to main content
我们经常发布文档更新,此页面的翻译可能仍在进行中。 有关最新信息,请访问英语文档

关于自动链接

具有仓库管理员权限的任何人均可配置自动链接引用,将议题、拉取请求提交消息、和发行说明链接到外部第三方服务。

自动链接在包含 GitHub Pro、GitHub Team、GitHub Enterprise Cloud、 和 GitHub Enterprise Server 的存储库中可用。

Anyone with admin permissions to a repository can configure autolink references to link issues, pull requests, commit messages, and release descriptions to external third-party services.

This procedure demonstrates how to configure autolinks to reference external resources. For example, if you use Zendesk to track user-reported tickets, you can reference a ticket number in the pull request you opened to fix the issue.

  1. On your GitHub Enterprise Server instance, navigate to the main page of the repository.

  2. Under your repository name, click Settings. If you cannot see the "Settings" tab, select the dropdown menu, then click Settings.

    Screenshot of a repository header showing the tabs. The "Settings" tab is highlighted by a dark orange outline.

  3. In the "Integrations" section of the sidebar, click Autolink references.

  4. At the top right of the page, click Add autolink reference.

    Screenshot of the "autolink references" page. The "Add autolink reference" button is highlighted by a dark orange outline.

  5. Under "Reference prefix", type a short, meaningful prefix. Collaborators will use this text to generate autolinks for the external resource.

  6. Under "Target URL", type the format of the link to the external system you want to create. Use the <num> variable as a placeholder for the reference identifier.

  7. Review the preview and verify that the autolink and external reference are both correct, then click Add autolink reference to define the link.

For example, you might enter the following.

  • Reference prefix: JIRA-
  • Target URL: https://jira.example.com/issue?query=<num>
  • Preview: JIRA-123 is converted to https://jira.example.com/issue?query=123