This version of GitHub Enterprise was discontinued on 2021-09-23. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.

Command-line utilities

GitHub Enterprise Server includes a variety of utilities to help resolve particular problems or perform specific tasks.

You can execute these commands from anywhere on the VM after signing in as an SSH admin user. For more information, see "Accessing the administrative shell (SSH)."

General

ghe-announce

This utility sets a banner at the top of every GitHub Enterprise page. You can use it to broadcast a message to your users.

You can also set an announcement banner using the enterprise settings on GitHub Enterprise Server. For more information, see "Customizing user messages on your instance."

# Sets a message that's visible to everyone
$ ghe-announce -s MESSAGE
> Announcement message set.
# Removes a previously set message
$ ghe-announce -u
> Removed the announcement message

ghe-check-disk-usage

This utility checks the disk for large files or files that have been deleted but still have open file handles. This should be run when you're trying to free up space on the root partition.

ghe-check-disk-usage

ghe-cleanup-caches

This utility cleans up a variety of caches that might potentially take up extra disk space on the root volume. If you find your root volume disk space usage increasing notably over time it would be a good idea to run this utility to see if it helps reduce overall usage.

ghe-cleanup-caches

ghe-cleanup-settings

This utility wipes all existing Management Console settings.

Tip: Typically, you will only execute this if you've contacted support and they've asked you to do so.

ghe-cleanup-settings

ghe-config

With this utility, you can both retrieve and modify the configuration settings of your GitHub Enterprise Server instance.

$ ghe-config core.github-hostname
# Gets the configuration value of `core.github-hostname`
$ ghe-config core.github-hostname 'example.com'
# Sets the configuration value of `core.github-hostname` to `example.com`
$ ghe-config -l
# Lists all the configuration values

Allows you to find the universally unique identifier (UUID) of your node in cluster.conf.

$ ghe-config HOSTNAME.uuid

Allows you to exempt a list of users from API rate limits. For more information, see "Resources in the REST API."

$ ghe-config app.github.rate-limiting-exempt-users "hubot github-actions"
# Exempts the users hubot and github-actions from rate limits

ghe-config-apply

This utility applies Management Console settings, reloads system services, prepares a storage device, reloads application services, and runs any pending database migrations. It is equivalent to clicking Save settings in the Management Console's web UI or to sending a POST request to the /setup/api/configure endpoint.

You will probably never need to run this manually, but it's available if you want to automate the process of saving your settings via SSH.

ghe-config-apply

ghe-console

This utility opens the GitHub Rails console on your GitHub Enterprise appliance. Do not use this command without direction from GitHub Enterprise Support. Incorrect use could cause damage or data loss.

ghe-console

ghe-dbconsole

This utility opens a MySQL database session on your GitHub Enterprise appliance. Do not use this command without direction from GitHub Enterprise Support. Incorrect use could cause damage or data loss.

ghe-dbconsole

ghe-es-index-status

This utility returns a summary of Elasticsearch indexes in CSV format.

Print an index summary with a header row to STDOUT:

$ ghe-es-index-status -do
> warning: parser/current is loading parser/ruby23, which recognizes
> warning: 2.3.3-compliant syntax, but you are running 2.3.4.
> warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
> Name,Primary,Searchable,Writable,UpToDate,RepairProgress,Version
> code-search-1,true,true,true,true,100.0,72e27df7c631b45e026b42bfef059328fa040e17
> commits-5,true,true,true,true,100.0,7ed28813100c47813ef654c0ee2bb9abf21ab744
> gists-4,true,true,true,true,100.0,cf8e7d04fcf2564c902e2873c424a279cc41079d
> issues-4,false,false,false,true,100.0,d0bb08f71eebf6e7b070572aa399b185dbdc8a76
> issues-5,true,true,true,true,100.0,d0bb08f71eebf6e7b070572aa399b185dbdc8a76
> projects-2,true,true,true,true,100.0,c5cac1c4b3c66d42e609d088d174dbc3dd44469a
> pull-requests-6,true,true,true,true,100.0,6a466ad6b896a3499509990979bf9a18d7d41de3
> repos-6,true,true,true,true,100.0,6c8b5fbba0fc1e409558db411d05e092c1387082
> users-5,true,true,true,true,100.0,38984875552bb826c9ec42999f409cb2e95556eb
> wikis-4,true,true,true,true,100.0,2613dec44bd14e14577803ac1f9e4b7e07a7c234

Print an index summary and pipe results to column for readability:

$ ghe-es-index-status -do | column -ts,
> warning: parser/current is loading parser/ruby23, which recognizes
> warning: 2.3.3-compliant syntax, but you are running 2.3.4.
> warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
> Name             Primary  Searchable  Writable  UpToDate  RepairProgress  Version
> code-search-1    true     true        true      true      100.0           72e27df7c631b45e026b42bfef059328fa040e17
> commits-5        true     true        true      true      100.0           7ed28813100c47813ef654c0ee2bb9abf21ab744
> gists-4          true     true        true      true      100.0           cf8e7d04fcf2564c902e2873c424a279cc41079d
> issues-4         false    false       false     true      100.0           d0bb08f71eebf6e7b070572aa399b185dbdc8a76
> issues-5         true     true        true      true      100.0           d0bb08f71eebf6e7b070572aa399b185dbdc8a76
> projects-2       true     true        true      true      100.0           c5cac1c4b3c66d42e609d088d174dbc3dd44469a
> pull-requests-6  true     true        true      true      100.0           6a466ad6b896a3499509990979bf9a18d7d41de3
> repos-6          true     true        true      true      100.0           6c8b5fbba0fc1e409558db411d05e092c1387082
> users-5          true     true        true      true      100.0           38984875552bb826c9ec42999f409cb2e95556eb
> wikis-4          true     true        true      true      100.0           2613dec44bd14e14577803ac1f9e4b7e07a7c234

ghe-legacy-github-services-report

This utility lists repositories on your appliance that use GitHub Services, an integration method that will be discontinued on October 1, 2018. Users on your appliance may have set up GitHub Services to create notifications for pushes to certain repositories. For more information, see "Announcing the deprecation of GitHub Services" on the GitHub Blog or "Replacing GitHub Services." For more information about this command or for additional options, use the -h flag.

ghe-legacy-github-services-report

ghe-logs-tail

This utility lets you tail log all relevant log files from your installation. You can pass options in to limit the logs to specific sets. Use the -h flag for additional options.

ghe-logs-tail

ghe-maintenance

This utility allows you to control the state of the installation's maintenance mode. It's designed to be used primarily by the Management Console behind-the-scenes, but it can be used directly.

ghe-maintenance -h

ghe-motd

This utility re-displays the message of the day (MOTD) that administrators see when accessing the instance via the administrative shell. The output contains an overview of the instance's state.

ghe-motd

ghe-nwo

This utility returns a repository's name and owner based on the repository ID.

ghe-nwo REPOSITORY_ID

ghe-org-admin-promote

Use this command to give organization owner privileges to users with site admin privileges on the appliance, or to give organization owner privileges to any single user in a single organization. You must specify a user and/or an organization. The ghe-org-admin-promote command will always ask for confirmation before running unless you use the -y flag to bypass the confirmation.

You can use these options with the utility:

  • The -u flag specifies a username. Use this flag to give organization owner privileges to a specific user. Omit the -u flag to promote all site admins to the specified organization.
  • The -o flag specifies an organization. Use this flag to give owner privileges in a specific organization. Omit the -o flag to give owner permissions in all organizations to the specified site admin.
  • The -a flag gives owner privileges in all organizations to all site admins.
  • The -y flag bypasses the manual confirmation.

This utility cannot promote a non-site admin to be an owner of all organizations. You can promote an ordinary user account to a site admin with ghe-user-promote.

Give organization owner privileges in a specific organization to a specific site admin

ghe-org-admin-promote -u USERNAME -o ORGANIZATION

Give organization owner privileges in all organizations to a specific site admin

ghe-org-admin-promote -u USERNAME

Give organization owner privileges in a specific organization to all site admins

ghe-org-admin-promote -o ORGANIZATION

Give organization owner privileges in all organizations to all site admins

ghe-org-admin-promote -a

ghe-reactivate-admin-login

Use this command to immediately unlock the Management Console after 10 failed login attempts in the span of 10 minutes.

$ ghe-reactivate-admin-login

ghe-resque-info

This utility displays information on background jobs, both active and in the queue. It provides the same job count numbers as the admin stats bar at the top of every page.

This utility can help identify whether the Resque server is having problems processing background jobs. Any of the following scenarios might be indicative of a problem with Resque:

  • The number of background jobs is increasing, while the active jobs remain the same.
  • The event feeds are not updating.
  • Webhooks are not being triggered.
  • The web interface is not updating after a Git push.

If you suspect Resque is failing, contact GitHub Enterprise Support or GitHub Premium Support for help.

With this command, you can also pause or resume jobs in the queue.

$ ghe-resque-info
# lists queues and the number of currently queued jobs
$ ghe-resque-info -p QUEUE
# pauses the specified queue
$ ghe-resque-info -r QUEUE
# resumes the specified queue

ghe-saml-mapping-csv

This utility can help map SAML records.

To create a CSV file containing all the SAML mapping for your GitHub Enterprise Server users:

$ ghe-saml-mapping-csv -d

To perform a dry run of updating SAML mappings with new values:

$ ghe-saml-mapping-csv -u -n -f /path/to/file

To update SAML mappings with new values:

$ ghe-saml-mapping-csv -u -f /path/to/file

ghe-service-list

This utility lists all of the services that have been started or stopped (are running or waiting) on your appliance.

$ ghe-service-list
start/running
  - github-resqued, process 12711
  - github-unicorn, process 12726
  - github-gitauth, process 12743
  - git-daemon, process 12755
  - babeld, process 12771
  - github-svn-proxy, process 12802
  - gist-unicorn, process 12832
  - gist-resqued, process 12881
  - render-unicorn, process 12939
  - hookshot-unicorn, process 13076
  - nodeload2, process 13192
  - slumlord-unicorn, process 13304
  - ghe-storage, process 2012
  - enterprise-manage-unicorn, process 2024
  - enterprise-manage-resque, process 2053

stop/waiting
  - ghe-replica-mode

ghe-set-password

With ghe-set-password, you can set a new password to authenticate into the Management Console.

ghe-set-password 

ghe-ssh-check-host-keys

This utility checks the existing SSH host keys against the list of known leaked SSH host keys.

$ ghe-ssh-check-host-keys

If a leaked host key is found the utility exits with status 1 and a message:

> One or more of your SSH host keys were found in the blacklist.
> Please reset your host keys using ghe-ssh-roll-host-keys.

If a leaked host key was not found, the utility exits with status 0 and a message:

> The SSH host keys were not found in the SSH host key blacklist.
> No additional steps are needed/recommended at this time.