# Connect GitHub

This guide walks you through authenticating your Genie server with GitHub so you can clone repos, push code, create pull requests, and use the GitHub CLI directly from your terminal.

***

## Prerequisites

* A Genie account with a running server
* A GitHub account

***

## Step 1: Run gh auth login

Open the terminal in your Genie dashboard and run:

```bash
gh auth login
```

![Terminal with gh auth login command](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-629088de2aa1d4d1c39f55af5226dfa2b13b19f5%2Fgh-auth-start.png?alt=media)

***

## Step 2: Select Account Type

Choose **GitHub.com** (or GitHub Enterprise Server if your organization uses it).

![Select GitHub.com or GitHub Enterprise Server](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-e28a331503b3aa03b2d6b18125e706d2052fe3cf%2Fgh-select-account.png?alt=media)

***

## Step 3: Choose Git Protocol

Select **HTTPS** as your preferred protocol for Git operations.

![Choose HTTPS or SSH protocol](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-2e58af1049bc0760e2b1d5e9a1f1b0dfd2d233c7%2Fgh-select-protocol.png?alt=media)

***

## Step 4: Confirm Git Credentials

When asked "Authenticate Git with your GitHub credentials?", type **Y** and press Enter.

![Confirm Git credential authentication](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-7e8490f9cbc3779e5d51de59e77973517c1f9689%2Fgh-confirm-credentials.png?alt=media)

***

## Step 5: Choose Authentication Method

Select **Paste an authentication token**. The CLI will show you the minimum required scopes: `repo`, `read:org`, `workflow`.

![Choose authentication method — paste a token](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-8097cbe21ded8fee310a65c4cb2615e1caba4e5d%2Fgh-auth-method.png?alt=media)

***

## Step 6: Generate a Personal Access Token

1. Open [github.com/settings/tokens](https://github.com/settings/tokens) in your browser.

![GitHub Personal Access Tokens page](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-20e779f27e09f18c77ab3b7340076f3c968c1b52%2Fgh-tokens-page.png?alt=media)

2. Click **Generate new token** and select **Generate new token (classic)**.

![Token generation dropdown — select classic](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-a68ee6729d7ced711d19d1e94cfb18754b5515e2%2Fgh-token-dropdown.png?alt=media)

3. Fill in the details:
   * **Note** — a description (e.g. "Genie server")
   * **Expiration** — choose a duration
   * **Scopes** — select at minimum: `repo`, `read:org`, `workflow`

Click **Generate token**.

![New personal access token form with scopes](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-c8f6a467f83aabba6bf089c4535ac3f0f97130da%2Fgh-create-token.png?alt=media)

***

## Step 7: Copy the Token

Your token is displayed once. Copy it immediately — you will not be able to see it again.

![Token created — copy it now](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-8606a528d6cde774c4f2ffd836aa02e74a047a82%2Fgh-token-created.png?alt=media)

***

## Step 8: Paste Token in Terminal

Go back to the Genie terminal and paste the token at the prompt.

![Pasting the token in the terminal](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-ebc0388ab70f4b1faa07b7dc5c128801296cf16c%2Fgh-paste-token.png?alt=media)

***

## Step 9: Verify Authentication

You should see a confirmation message: **"Logged in as \<your-username>"**.

![Authentication successful — logged in](https://253630326-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy3wRNrxvvjTFreyXSBOV%2Fuploads%2Fgit-blob-92d86aa884b95e826329179177f8c23bc640a608%2Fgh-auth-success.png?alt=media)

You can now use `git` and `gh` commands with full access to your GitHub account.

***

## Tips

* Minimum required token scopes: `repo`, `read:org`, `workflow`
* You can re-authenticate anytime by running `gh auth login` again
* To check your current auth status: `gh auth status`
* The token is stored on your Genie server — keep your server credentials secure
* If your token expires, generate a new one and re-authenticate
