To use GitHub Copilot in an IDE or the command line, you must authenticate to an account on GitHub that has a Copilot license.
If you receive access to Copilot through a managed user account owned by an enterprise on GHE.com, you may need to adjust some settings in your IDE before you can authenticate to your account.
Use the tabs at the top of this article to see instructions for your environment.
Authenticating from the command line
To use the gh-copilot
extension for the GitHub CLI, you must:
- Download and install the extension. To do this, you must be authenticated to an account on GitHub.com. See Installing GitHub Copilot in the CLI.
- Authenticate to the account on GHE.com where you receive your Copilot license.
GitHub.com is the default destination of GitHub CLI requests. To use gh copilot
, you must ensure requests are sent to GHE.com, where you receive your license. You have the following options:
- Include the flag
--hostname SUBDOMAIN.ghe.com
in allgh copilot
commands. - Set the
GH_HOST
environment variable to change the default host for all GitHub CLI commands. - Sign out of GitHub.com with
gh auth logout
. However, you will need to sign back in to get updates togh-copilot
.
For general information on using the GitHub CLI across platforms, see Using the GitHub CLI across GitHub platforms.