Repositories
Detach a fork
Detach a fork from its parent: it becomes an ordinary repository with no parent, and can then be made public or private.
POST
/repos/{owner}/{name}/detachNeeds the Admin role on the fork. Its code, settings, and the pull requests it already opened into the parent stay as they are; it can no longer be synced or open new pull requests into the parent. It cannot be attached again.
The repository, now with no parent. Needs the Admin role (403 otherwise); 422 when it is not a fork. It cannot be attached again. See Detach a fork.
- Authentication: Required. Send an access token as
Authorization: Bearer. - MCP tool:
repositorywithactiondetach_fork, and the same inputs - Scope: An access token needs
repo:admin.
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. |
Example request
Section titled “Example request”curl -X POST https://api.g1t.sh/repos/flagon-io/hello/detach \ -H "Authorization: Bearer $G1T_TOKEN"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": null, "parent": null, "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. |
| 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. |