# Connecting Git repositories

Eraser supports connecting repositories from **GitHub** and **GitLab** (**Azure DevOps** and **Bitbucket** coming soon). By connecting your Git repositories, you can:

* Use your codebase as context to automatically generate AI diagrams (e.g. "draw an architecture diagram of our `aws/staging/` environment")
* Set up Eraserbot to monitor and keep important diagrams synced with your code
* Commit `.md` and `.eraserdiagram` files directly to your repository from Eraser

To get started, connect your organization from your preferred Git platform.

## Connecting GitHub repositories

1. Go to **Settings** > [**Git Connect**](https://app.eraser.io/dashboard/all?settings=gitConnect)

<Figure src="/assets/7f79ce4aa95074ace82e75ababc94231102e3fc1612f89a111ca943138610eee-image.png" alt="" border />

2. Click **Connect new git org** > **GitHub**
3. Log in to your GitHub account, select the organization you'd like to connect, and install the Eraser GitHub App. Choose which repositories to authorize and click **Install & Authorize**.

<Figure src="/assets/0983b67-image.png" alt="" width="500px" border />

4. Your authorized repositories will appear on the [Git Connect](https://app.eraser.io/dashboard/all?settings=gitConnect) page in Eraser.

<Figure src="/assets/835f7e609ccf0d9cfb58ea30c6af4f4743aae23cdde5de481f3cc81f81b3b366-image.png" alt="" border />

## Connecting GitLab repositories

1. Go to **Settings** > [**Git Connect**](https://app.eraser.io/dashboard/all?settings=gitConnect)

<Figure src="/assets/7f79ce4aa95074ace82e75ababc94231102e3fc1612f89a111ca943138610eee-image.png" alt="" border />

2. Click **Connect new git org** > **GitLab**
3. Create a GitLab access token with `api` scope and paste it on this page. You can use a [personal](https://gitlab.com/-/user_settings/personal_access_tokens), [group](https://docs.gitlab.com/user/group/settings/group_access_tokens/), or [project](https://docs.gitlab.com/user/project/settings/project_access_tokens/) access token. 

<Figure src="/assets/7e033c93e8caf3fc1e712832d7743c51d5ec7aa526d0242ab739559e4fd7cc0f-image.png" alt="" border />

4. Select the GitLab projects you'd like to connect to Eraser.

<Figure src="/assets/560742619f9ef634b8849a2876d1645ec9bd6141c6495e89245363db0c0b6234-image.png" alt="" border />

5. Your connected projects will appear in the [Git Connect](https://app.eraser.io/dashboard/all?settings=gitConnect) page in Eraser.

<Figure src="/assets/ee5861240e171f35c77f3b94a410d3a5a569436389b14fa41aabb149fd0df12a-image.png" alt="" border />

## Managing Git repositories

For each connected repository, you can configure one of the following access levels:

* **Active**: Eraser can access this repository to generate [codebase diagrams](/codebase-diagrams) and enable [Eraserbot monitors](/eraserbot).
* **Active and synced**: In addition to all the Active capabilities, Eraser can also commit `.md` files and `.eraserdiagram` files to the repository and pull them back in.
* **Inactive**: Eraser has no access to this repository.

<Figure src="/assets/e72679f4cd93b3cb6bc56710ee4c52ab0ba631903459f441f9f08ad3db96f709-image.png" alt="" border />
