Skip to main content

此版本的 GitHub Enterprise Server 将于以下日期停止服务 2026-03-17. 即使针对重大安全问题,也不会发布补丁。 为了获得更好的性能、更高的安全性和新功能,请升级到最新版本的 GitHub Enterprise。 如需升级帮助,请联系 GitHub Enterprise 支持

在企业上禁用 Git SSH 访问

您可以阻止用户为企业上的某些仓库或所有仓库使用 Git over SSH。

Disabling Git SSH access to a specific repository

注意

Each repository automatically inherits default settings from the organization or user that owns it. You cannot override the default setting if the repository's owner has enforced the setting on all of their repositories.

  1. From an administrative account on GitHub Enterprise Server, in the upper-right corner of any page, click .
  2. If you're not already on the "Site admin" page, in the upper-left corner, click Site admin.
  3. Under "Search users, organizations, teams, repositories, gists, and applications", type the name of the repository in the text field. Then to the right of the field, click Search.
    Screenshot of the "Search" page of the "Site admin" settings. The button to search repositories, labeled "Search," is outlined.
  4. Under "Search results – Repositories", click the name of the repository.
  5. From an administrative account on GitHub Enterprise Server, in the upper-right corner of any page, click .
  6. If you're not already on the "Site admin" page, in the upper-left corner, click Site admin.
  7. In the upper-right corner of the page, click Admin.
    Screenshot of the header of the "Site admin" page for a user or repository. The "Admin" tab is highlighted with an orange outline.
  8. Under "Git SSH access", select the drop-down menu, and click Disabled.

Disabling Git SSH access to all repositories owned by a user or organization

  1. From an administrative account on GitHub Enterprise Server, in the upper-right corner of any page, click .

  2. If you're not already on the "Site admin" page, in the upper-left corner, click Site admin.

  3. Under "Search users, organizations, teams, repositories, gists, and applications", type the name of the user or organization in the text field. Then to the right of the field, click Search.

    Screenshot of the "Search" page of the "Site admin" settings. The button to search users and organizations, labeled "Search," is outlined.

  4. In the search results, click the name of the user or organization.

    Screenshot of the "Accounts" search results. In the list of matches, "user1" is highlighted with an orange outline.

  5. From an administrative account on GitHub Enterprise Server, in the upper-right corner of any page, click .

  6. If you're not already on the "Site admin" page, in the upper-left corner, click Site admin.

  7. In the upper-right corner of the page, click Admin.

    Screenshot of the header of the "Site admin" page for a user or repository. The "Admin" tab is highlighted with an orange outline.

  8. Under "Git SSH access", select the drop-down menu, and click Disabled.

  9. Select Enforce on all repositories.

    Screenshot of the "Git SSH access" section of the site admin page for an organization. The "Enforce on all repositories" checkbox is outlined.

Disabling Git SSH access to all repositories in your enterprise

  1. In the top-right corner of GitHub Enterprise Server, click your profile picture, then click Enterprise settings.

  2. On the left side of the page, in the enterprise account sidebar, click Policies.

  3. Under Policies, click Options.

  4. Under "Git SSH access", select the drop-down menu, and click Disabled.

  5. Select Enforce on all repositories.

    Screenshot of the "Git SSH access" section on the enterprise's policies page. The "Enforce on all repositories" checkbox is outlined.