ghe‐delete‐user - elliottcarlson/ghe GitHub Wiki

This utility enables deletion of Github Enterprise users from the command line. Github Enterprise does not provide access to this functionality via an API or utility, outside of the admin interface.

To accomplish this, we utilize the Python Selenium binding with PhantomJS. This allows us to login as an administrative user, locate and verify the correct user is being selected, and perform a delete user request via the web interface.

As with all scripts being run from within GHE CLI, the ghe-host, ghe-user, ghe-pass, ghe-totp are automatically set via the localized environment and do not need to be provided on the command line.

Delete a user via their username:

GHE> delete-user username
Are you sure you want to delete the user "username"? [y/n] y
Deleting user "username".
Done.
GHE>

Help

GHE> delete-user -h
usage: ghe-delete-user.py [-h] [-no-confirm] [-ghe-host HOST] [-ghe-user USER]
                          [-ghe-pass PASS] [-debug]
                          [USERNAME]

Tool to delete a Github Enterprise user.

positional arguments:
  USERNAME        username to delete

optional arguments:
  -h, --help      show this help message and exit
  -no-confirm     skip dialog requesting confirmation of deletion.
  -ghe-host HOST  the hostname to your GitHub Enterprise server (default:
              value from `ghe-host` environment variable)
  -ghe-user USER  username of a Github Enterprise user with admin priveleges.
  -ghe-pass PASS  password of user passed in with -ghe-user.
  -ghe-totp KEY   base 32 secret to generate two-factor key
  -debug          enable debug mode
GHE>
⚠️ **GitHub.com Fallback** ⚠️