---
title: GitHub
icon: github
description: Set up the GitHub resource in Python.
---

## Dependencies

No additional dependencies - uses `aiohttp` (included).

For credential setup, see the [GitHub Setup](/home/setup/github) guide.

## Configuration

```python
import os
from mirage import Workspace, MountMode
from mirage.resource.github import GitHubConfig, GitHubResource

config = GitHubConfig(token=os.environ["GITHUB_TOKEN"])
resource = GitHubResource(
    config=config, owner="my-org", repo="my-repo", ref="main")
ws = Workspace({"/github": resource}, mode=MountMode.READ)
```

Constructing the mount names the repository and contacts nothing, so it is
an ordinary call from sync or async code. The git tree and the default
branch are fetched on the first read that needs them.

## Config Reference

| Field   | Required | Description                  |
| ------- | -------- | ---------------------------- |
| `token` | Yes      | GitHub Personal Access Token |
