Skip to main content

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

Suspending and unsuspending users

If a user leaves or moves to a different part of the company, you should remove or modify their ability to access 您的 GitHub Enterprise Server 实例.

If employees leave the company, you can suspend their GitHub Enterprise Server accounts to open up user licenses in your GitHub Enterprise license while preserving the issues, comments, repositories, gists, and other data they created. Suspended users cannot sign into your instance, nor can they push or pull code.

When you suspend a user, the change takes effect immediately with no notification to the user. If the user attempts to pull or push to a repository, they'll receive this error:

$ git clone git@[hostname]:john-doe/test-repo.git
Cloning into 'test-repo'...
ERROR: Your account is suspended. Please check with your installation administrator.
fatal: The remote end hung up unexpectedly

Before suspending site administrators, you must demote them to regular users. For more information, see "Promoting or demoting a site administrator."

Note: If LDAP Sync is enabled for 您的 GitHub Enterprise Server 实例, users are automatically suspended when they're removed from the LDAP directory server. When LDAP Sync is enabled for your instance, normal user suspension methods are disabled.

Suspending a user from the user admin dashboard

  1. 从 GitHub Enterprise Server 上的管理帐户中,在任何页面的右上角,单击

    用于访问站点管理员设置的火箭飞船图� �的屏幕截图

  2. 如果您尚未进入“站点管理员”页面,请在左上角单击 Site admin(站点管理员)

    "站点管理员" 链接的屏幕截图

  3. 在搜索字段中,输入用户的名称,然后单击 Search(搜索)站点管理员设置搜索字段

  4. 在搜索结果中,单击用户名称。 站点管理设置搜索选项

  5. 在页面的右上角,单击 Admin(管理员)管理员工具

  6. 在左侧边� �中,单击 Admin(管理员)管理员工具

  7. Under "Account suspension," in the red Danger Zone box, click Suspend. Suspend button

  8. Provide a reason to suspend the user. Suspend reason

Unsuspending a user from the user admin dashboard

As when suspending a user, unsuspending a user takes effect immediately. The user will not be notified.

  1. 从 GitHub Enterprise Server 上的管理帐户中,在任何页面的右上角,单击

    用于访问站点管理员设置的火箭飞船图� �的屏幕截图

  2. 如果您尚未进入“站点管理员”页面,请在左上角单击 Site admin(站点管理员)

    "站点管理员" 链接的屏幕截图

  3. In the left sidebar, click Suspended users. Suspended users tab

  4. Click the name of the user account that you would like to unsuspend. Suspended user

  5. 在页面的右上角,单击 Admin(管理员)管理员工具

  6. 在左侧边� �中,单击 Admin(管理员)管理员工具

  7. Under "Account suspension," in the red Danger Zone box, click Unsuspend. Unsuspend button

  8. Provide a reason to unsuspend the user. Unsuspend reason

Suspending a user from the command line

  1. SSH 连接到 您的 GitHub Enterprise Server 实例。 更多信息请参阅“访问管理 shell (SSH)。”
    $ ssh -p 122 admin@HOSTNAME
  2. Run ghe-user-suspend with the username to suspend.
    $ ghe-user-suspend username

Creating a custom message for suspended users

You can create a custom message that suspended users will see when attempting to sign in.

  1. 在 GitHub Enterprise Server 的右上角,单击您的个人资料照片,然后单击 Enterprise settings(Enterprise 设置)GitHub Enterprise Server 上个人资料照片下拉菜单中的"Enterprise settings(企业设置)"

  2. 在企业帐户侧边� �中,单击 Settings(设置)企业帐户侧边� �中的“设置”选项卡

  3. 在 “ 设置”下,单击 Messages(消息)企业设置侧边� �中的“消息”选项卡

  4. Click Add message. Add message

  5. Type your message into the Suspended user message box. You can type Markdown, or use the Markdown toolbar to style your message. Suspended user message

  6. Click the Preview button under the Suspended user message field to see the rendered message. Preview button

  7. Review the rendered message. Suspended user message rendered

  8. 在页面底部,单击 Save changes(保存更改)保存更改

Unsuspending a user from the command line

  1. SSH 连接到 您的 GitHub Enterprise Server 实例。 更多信息请参阅“访问管理 shell (SSH)。”
    $ ssh -p 122 admin@HOSTNAME
  2. Run ghe-user-unsuspend with the username to unsuspend.
    $ ghe-user-unsuspend username

Further reading