> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mantlebio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub

<a name="footnote1_back" />

<img noZoom className="block dark:hidden" src="https://mintcdn.com/mantlebio/sdvHTAr-XRL3RKUT/assets/integration_logos/github.png?fit=max&auto=format&n=sdvHTAr-XRL3RKUT&q=85&s=47eb80e0c332fe0f1f961f21dfaa7920" width="150" data-path="assets/integration_logos/github.png" />

<img noZoom className="hidden dark:block" src="https://mintcdn.com/mantlebio/sdvHTAr-XRL3RKUT/assets/integration_logos/github-dark-mode.png?fit=max&auto=format&n=sdvHTAr-XRL3RKUT&q=85&s=562c322eeb7d64121332f9ab804859d4" width="150" data-path="assets/integration_logos/github-dark-mode.png" />

Mantle simplifies code reusability and supports developer best practices by allowing you to connect directly to your public and private GitHub repositories.

* Manage GitHub connections seamlessly in Mantle.
* Access connected GitHub repos directly within Mantle Notebooks.
* Add custom Nextflow pipelines from connected GitHub repos.[\*](#footnote1)

## How to connect a GitHub repository to Mantle

The Mantle GitHub integration allows you to connect any of your private repositories so that you can access the contents in Mantle.

<Steps>
  <Step title="Add a new GitHub integration">
    * Navigate to the [Integrations](https://app.mantlebio.com/integrations) tab within Mantle and scroll down to the **Add a New Integration** section.
    * Click on the GitHub card.

    <Frame>
      <img noZoom src="https://mintcdn.com/mantlebio/sdvHTAr-XRL3RKUT/assets/add_new_github_integration.png?fit=max&auto=format&n=sdvHTAr-XRL3RKUT&q=85&s=ce79acaea05f4cea448080b056219458" width="2590" height="794" data-path="assets/add_new_github_integration.png" />
    </Frame>
  </Step>

  <Step title="Fill out the form that appears and click the Add Integration button">
    <a name="enter_token" />

    * Enter the name you want to use to refer to the repo in Mantle.
    * Enter the repo URL in the following format: `github.com/<resource-owner>/<repo-name>`.
    * Enter a GitHub token that enables read access to the repo. See [below](#how-to-generate-a-github-token) for instructions on how to generate this token.

    <Frame>
      <img noZoom src="https://mintcdn.com/mantlebio/sdvHTAr-XRL3RKUT/assets/new_github_integration_modal.png?fit=max&auto=format&n=sdvHTAr-XRL3RKUT&q=85&s=526f60d0680c52cdb0f5e64b20992df6" width="350" data-path="assets/new_github_integration_modal.png" />
    </Frame>
  </Step>
</Steps>

### How to generate a GitHub token

To give Mantle read access to your GitHub repo, you will provide a GitHub token.

<Steps>
  <Step title="Navigate to the token settings in your GitHub account">
    Go to the [**Fine-grained tokens**](https://github.com/settings/tokens?type=beta) settings in GitHub.
  </Step>

  <Step title="In the top right corner, click the Generate new token button">
    <Frame>
      <img noZoom src="https://mintcdn.com/mantlebio/sdvHTAr-XRL3RKUT/assets/generate_new_token.png?fit=max&auto=format&n=sdvHTAr-XRL3RKUT&q=85&s=1987971ee1eb9434ebd5c0771b1d8d10" width="1586" height="236" data-path="assets/generate_new_token.png" />
    </Frame>
  </Step>

  <Step title="Fill out the form that appears">
    * Give the token a name.
    * Select the resource owner of the repo you are connecting to Mantle.
    * Set the expiration date. After this date, Mantle will no longer have access to your repo and you will need to generate a new token.
    * Select the repos you want the token to grant access to. We recommend creating one token per repo.

    <Frame>
      <img noZoom src="https://mintcdn.com/mantlebio/sdvHTAr-XRL3RKUT/assets/select_github_repository.png?fit=max&auto=format&n=sdvHTAr-XRL3RKUT&q=85&s=5987ed7bb2cb9263a9464f263eeda7a4" width="400" data-path="assets/select_github_repository.png" />
    </Frame>

    * Scroll down to the Permissions section and expand the Repository permissions section.
    * Scroll down to the Contents section and set the Access level to Read-only.

    <Frame>
      <img noZoom src="https://mintcdn.com/mantlebio/sdvHTAr-XRL3RKUT/assets/set_repo_permissions.png?fit=max&auto=format&n=sdvHTAr-XRL3RKUT&q=85&s=96b14c2e98776b754ee1e7787a56729e" width="1574" height="424" data-path="assets/set_repo_permissions.png" />
    </Frame>

    * Scroll all the way to the bottom of the page and click the Generate token button.

    <Frame>
      <img noZoom src="https://mintcdn.com/mantlebio/sdvHTAr-XRL3RKUT/assets/generate_token.png?fit=max&auto=format&n=sdvHTAr-XRL3RKUT&q=85&s=1ffd54bea3f1588f22f083f8ceb17ef2" width="200" data-path="assets/generate_token.png" />
    </Frame>
  </Step>

  <Step title="Copy and paste your token">
    * Paste the token into [the form](#enter_token) for adding a new GitHub connection in Mantle.

    <Warning>
      The token will only be shown to you this time. You can store the token in a secure location, such as a password manager.
    </Warning>
  </Step>
</Steps>

## How to access a connected GitHub repo in a Mantle Notebook

All of your connected GitHub repos are available from within Mantle Notebooks.
When you start a Mantle Notebook, the connected repos will be cloned into your Notebook's environment.

Repos are stored within the `github_repos` directory in the root directory of all Notebooks. You can access the files within each repo at `github_repos/<repo_name>`.

<a name="footnote1" />[\*](#footnote1_back)*Adding custom pipelines is available to professional and enterprise users. Contact us to learn more.*
