---
title: "Link your GitHub account to Grafana Assistant | Grafana Cloud documentation"
description: "Use gcx to link the GitHub account Grafana Assistant uses to author pull requests and answer @grafana mentions with your GitHub permissions."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Link your GitHub account to Grafana Assistant

Grafana Assistant authors pull requests and answers `@grafana` mentions with the permissions of the GitHub account linked to your Grafana user. Use `gcx` to link that account, check which one is linked, and unlink it. **GitHub account commands are experimental and require Grafana Cloud**.

## Before you begin

Before you link your GitHub account, complete the following tasks:

- [Configure a gcx context](https://grafana.com/docs/grafana-cloud/ai-tools/gcx/configuration) for a Grafana Cloud stack with GitHub connected to Grafana Assistant.
- [Sign in to the context as yourself](https://grafana.com/docs/grafana-cloud/ai-tools/gcx/authentication) with `gcx login --oauth`. A GitHub account links to a Grafana user, so you can’t use a context that authenticates with a service account token.
- Make sure you have the `grafana-assistant-app.chats:access` or `grafana-assistant-app.github:write` action.

## Link your account

To link your GitHub account to your Grafana user, complete the following steps:

1. Run the following command:
   
   shell ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```shell
   gcx assistant github-account link
   ```
   
   `gcx` opens GitHub in your browser. If the browser doesn’t open, visit the URL that `gcx` prints.
2. Make sure your browser is signed in to Grafana as the same user as your `gcx` context.
3. Approve access on GitHub.
   
   `gcx` links the GitHub account that approves access, so your GitHub and Grafana usernames don’t need to match. The command waits up to 10 minutes for you to approve access. To cancel, press `Ctrl+C`.
4. When `gcx` confirms the linked account, close the browser tab.

When an account is already linked, `link` changes nothing. To link a different account, unlink the current one first.

## Check the linked account

To see which GitHub account is linked to your Grafana user, run the following command:

shell ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy

```shell
gcx assistant github-account status
```

If someone revokes the account’s GitHub authorization, `status` shows the account as not linked. To restore the link, run `link` again.

## Unlink your account

To remove the GitHub account from your Grafana user, run the following command:

shell ![Copy code to clipboard](https://grafana.com/media/images/icons/icon-copy-small-2.svg) Copy

```shell
gcx assistant github-account unlink
```

Unlinking also revokes Grafana Assistant’s GitHub authorization for the account. The command asks for confirmation. To skip it, add `--force`.

If you connected the account under **Git hosts** in Grafana Assistant settings, you can only disconnect it there.
