Repositories
Fork a repository
Fork a repository: copy it into a workspace you can create repositories in, as a new repository that remembers the one it came from (its parent).
/repos/{owner}/{name}/forksAnyone who can read a public repository may fork it; a private one only when its admins allow forking (allow_forking on update_repo). A fork is exactly as visible as its parent: a public repository’s fork is public, a private one’s private. Only its code comes with it: the default branch, or every branch and tag with default_branch_only false. Its project starts with the parent project’s description. Its issues, pull requests, settings, rulesets, secrets, variables, webhooks, environments and deployments stay behind; issues are off in the fork, and Actions is off until an admin of the fork turns it on. Its full size counts toward the destination workspace’s storage, and a free workspace takes a private fork only while its private storage has room. workspace is the destination’s slug: your personal workspace when left out. name is the parent’s when left out. Returns the fork, with parent naming the repository it came from.
The new fork, with parent naming the repository it came from. Refused with 403 when the repository is private and its admins have not allowed forking, or when you cannot create repositories in the workspace; 409 when the workspace already has a repository of that name (give another name); 402 when a free workspace’s private storage has no room for a private fork. Its code and description are copied; nothing else is. See Forking a repository and Forks.
- Authentication: Required. Send an access token as
Authorization: Bearer. - MCP tool:
repositorywithactionfork, and the same inputs - Scope: An access token needs
repo:write.
Path parameters
Section titled “Path parameters”| Name | Type | Required | Description |
|---|---|---|---|
owner |
string | Yes | The workspace that owns the repository. |
name |
string | Yes | The repository’s name. |
Body parameters
Section titled “Body parameters”Send a JSON object. Names are snake_case, as in responses; the camelCase spelling is accepted too.
| Name | Type | Required | Description |
|---|---|---|---|
workspace |
string | No | The slug of the workspace to fork it into, e.g. “flagon-io”. Your personal workspace when left out. |
name |
string | No | The fork’s name; the repository’s own when left out. |
default_branch_only |
boolean | No | Copy only the default branch (the default). false copies every branch and tag. |
Example request
Section titled “Example request”curl -X POST https://api.g1t.sh/repos/flagon-io/hello/forks \ -H "Authorization: Bearer $G1T_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "workspace": "ada", "default_branch_only": true }'Example response
Section titled “Example response”A successful request answers 200 with:
{ "id": "rep_01m4b7k2v9c3tq8x5n6d0fr1hz", "namespace": "ada", "name": "hello", "is_private": false, "owner_id": "usr_01kq3r8w2m6vd5e9t0hy7jx4cb", "default_branch": "main", "fork_of": null, "parent_id": "rep_01m3m5q6p0e2qaw6mmjahk0qrr", "parent": { "namespace": "flagon-io", "name": "hello" }, "allow_forking": false, "protected": false, "created_at": "2026-10-14T09:30:12.418Z", "website": null, "archived_at": null}Errors
Section titled “Errors”A failed request answers with one of these statuses and a body like {"error": {"code": "not_found", "message": "Repository not found."}}. See errors.
| Status | Code | When |
|---|---|---|
| 401 | unauthenticated |
A token is required, or the one sent is not valid. |
| 402 | payment_required |
The workspace cannot start this work: it needs the g1t plan or a card check, or it is at a limit. See usage and billing. |
| 403 | forbidden |
The token is valid but not allowed to do this, such as a member-only change, or a token without the scope it needs. |
| 404 | not_found |
It does not exist, or you cannot see it. |
| 409 | conflict |
The request conflicts with the current state. |
| 422 | invalid |
The input is not valid. message says which field and why. |