Skip to main content
Create a repository in the current or specified organization. Required scope: write
repo = await mesa.repos.create(name="app")
print(repo.name)
print(repo.head_change_id)
Create with an upstream Git remote:
from mesa_sdk.types import TokenAuth, UpstreamConfig

repo = await mesa.repos.create(
    name="app",
    default_bookmark="main",
    upstream=UpstreamConfig(
        url="https://github.com/acme/app.git",
        auth=TokenAuth(token="github_pat_...", token_username="bot"),
    ),
)

Options

org
str | None
Organization override.
name
str | None
Repository name. If omitted, the API generates a name.
default_bookmark
str | None
Default bookmark name. Defaults to main when omitted.
upstream
UpstreamConfig | None
Optional upstream Git remote to attach at create time. On create, auth=UNSET and auth=None both create a public upstream. Pass TokenAuth or UsernamePasswordAuth to store credentials.

Response

id
str
Repository ID.
org
str
Organization slug.
name
str
Repository name.
default_bookmark
str
Default bookmark name.
head_change_id
str
Current change ID at the default bookmark tip.
upstream
UpstreamConfig | None
Configured upstream remote, or null when no upstream is configured.
created_at
datetime
Creation time.
tags
dict[str, str]
Repository tags.

UpstreamConfig

url
str
Upstream Git remote URL.
auth_kind
'token' | 'username_password' | None
Stored upstream authentication kind, or null when the upstream is public.