


# authenticate with a specific GitHub instance $ gh auth login -hostname enterprise. Connecting to GitHub with SSH You can connect to GitHub using the Secure Shell Protocol (SSH), which provides a secure channel over an unsecured network. You can connect to GitHub using the Secure Shell Protocol (SSH), which provides a secure channel over an unsecured network. # authenticate against by reading the token from a file $ gh auth login -with-token < mytoken.txt To use gh in GitHub Actions, add GH_TOKEN: $ -h, -hostname The hostname of the GitHub instance to authenticate with -insecure-storage Save authentication credentials in plain text instead of credential store -s, -scopes Additional authentication scopes to request -w, -web Open a browser to authenticate -with-token Read token from standard input Examples # start interactive setup $ gh auth login This method is most suitable for "headless" use of gh such as in automation. I assume when I first authenticated (I just ran gh auth login.Not in any specific context) I did not request these additional rights.

Create a repo To put your project up on GitHub, you will need to create a repository for it to live in. Now that we have the ssh key setup on our computer, we need to set it up on the GitHub website. The minimum required scopes for the token are: "repo", "read:org".Īlternatively, gh will use the authentication token found in environment variables. To configure your account on to use your new (or existing) SSH key, you'll also need to add the key to your account. After completion, anĪuthentication token will be stored internally.Īlternatively, use -with-token to pass in a token on standard input. The default authentication mode is a web-based browser flow.
