---
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 = await GitHubResource.build(
    config=config, owner="my-org", repo="my-repo", ref="main")
ws = Workspace({"/github": resource}, mode=MountMode.READ)
```

`build` is a coroutine because it fetches the repo's git tree up front, so
call it from async code. Every resource inherits a `build`; only the ones
that need I/O to start override it, so `await Resource.build(...)` is
uniform.

## Config Reference

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