Skip to content

Update repository settings

PUT /api/v5/repos/{owner}/{repo}/repo_settings

The user calls this endpoint to update repository settings. All fields in the request body are optional; fields that are not passed keep their original settings.

Access token support

  • AtomGit user access tokens (AtomGit user access tokens)

Anonymous access allowed?

This endpoint does not allow anonymous access.

Request parameters

Parameter Location Type Required Description
owner path string Yes Address path of the namespace the repository belongs to (the address path of an enterprise, organization, or individual)
repo path string Yes Repository path (path)
access_token query string Yes User authorization code

Request Body:

The request body is a JSON object. All fields are optional; fields that are not passed keep their original settings.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "disable_fork": {
      "description": "Prohibit forking the project (disallow Fork)",
      "type": "boolean"
    },
    "forbidden_developer_create_branch": {
      "description": "Prohibit developers from creating branches",
      "type": "boolean"
    },
    "forbidden_developer_create_tag": {
      "description": "Prohibit developers from creating tags",
      "type": "boolean"
    },
    "forbidden_committer_create_branch": {
      "description": "Prohibit committers from creating branches",
      "type": "boolean"
    },
    "forbidden_developer_create_branch_user_ids": {
      "description": "Whitelist user IDs for the restriction on developers creating branches",
      "type": "string"
    },
    "branch_name_regex": {
      "description": "Branch name regular expression",
      "type": "string"
    },
    "tag_name_regex": {
      "description": "Tag name regular expression",
      "type": "string"
    },
    "generate_pre_merge_ref": {
      "description": "Generate the Pre-Merge ref for MergeRequest",
      "type": "boolean"
    },
    "rebase_disable_trigger_webhook": {
      "description": "MR rebase does not trigger Webhook events",
      "type": "boolean"
    },
    "open_gpg_verified": {
      "description": "Public GPG public key verification",
      "type": "boolean"
    },
    "include_lfs_objects": {
      "description": "Compressed package download includes LFS objects",
      "type": "boolean"
    },
    "action_pipeline_enabled": {
      "description": "Whether Action pipelines are enabled",
      "type": "boolean"
    },
    "block_cross_repo_pr_trigger": {
      "description": "Prevent cross-repository PRs from triggering Actions",
      "type": "boolean"
    },
    "show_branch_creator": {
      "description": "Whether to show branch creator information, corresponding to the \"Show branch creator information\" checkbox on the page; unchanged when not passed",
      "type": "boolean"
    }
  },
  "required": []
}

Response parameters

Field Type Always returned Nullable Description
forbidden_developer_create_branch boolean Yes No Prohibit developers from creating branches
forbidden_developer_create_tag boolean Yes No Prohibit developers from creating tags
forbidden_committer_create_branch boolean Yes No Prohibit committers from creating branches
generate_pre_merge_ref boolean Yes No Generate the Pre-Merge ref for MergeRequest
forbidden_gitlab_access boolean Yes No Prohibit GitLab access
rebase_disable_trigger_webhook boolean Yes No Prohibit MR rebase from triggering Webhook events
action_pipeline_enabled boolean Yes No Whether Action pipelines are enabled
block_cross_repo_pr_trigger boolean Yes No Prevent cross-repository PRs from triggering Actions
show_branch_creator boolean Yes No Whether to show branch creator information, corresponding to the "Show branch creator information" checkbox on the page
disable_fork boolean No Yes Prohibit forking the project
forbidden_developer_create_branch_users array No Yes Whitelist when developers are prohibited from creating branches
branch_name_regex string No Yes Branch name regular expression
tag_name_regex string No Yes Tag name regular expression
open_gpg_verified boolean No Yes Enable GPG public key verification
include_lfs_objects boolean No Yes Compressed package download includes LFS objects

forbidden_developer_create_branch_users object

Field Type Always returned Nullable Description
forbidden_developer_create_branch_users.id integer No Yes ID
forbidden_developer_create_branch_users.push_rule_id integer No Yes Push rule ID
forbidden_developer_create_branch_users.user_id integer No Yes User ID
forbidden_developer_create_branch_users.user_name string No Yes User name

Error response

On failure, a unified error response body is returned with the fields error_code (error code), error_code_name (error name), error_message (error message), and trace_id (trace ID). The actual error field names are subject to what the backend returns.

400 Parameter error

{
  "error_code": 400,
  "error_code_name": "PARAMETER_ERROR",
  "error_message": "Parameter error",
  "trace_id": "9f8c1a2b..."
}

401 Unauthenticated

{
  "error_code": 401,
  "error_code_name": "UNAUTHORIZED",
  "error_message": "Missing or invalid access token",
  "trace_id": "9f8c1a2b..."
}

403 Forbidden

{
  "error_code": 403,
  "error_code_name": "FORBIDDEN",
  "error_message": "You do not have permission to perform this operation",
  "trace_id": "9f8c1a2b..."
}

404 Repository not found

{
  "error_code": 404,
  "error_code_name": "NOT_FOUND",
  "error_message": "Repository does not exist",
  "trace_id": "9f8c1a2b..."
}

HTTP response status codes

Status code Description
200 Success (OK)
400 Parameter error (Bad Request)
401 Authentication required (Requires authentication)
403 Forbidden
404 Repository not found (Not Found)
429 Too many requests (Rate Limited)
500 Internal system error (Internal Server Error)

Request example

Parameter description

Replace <owner> with the address path of the namespace the repository belongs to (the address path of an enterprise, organization, or individual); replace <repo> with the repository path (path); replace <token> with your AtomGit user access token.

cURL

curl -X PUT 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/repo_settings?access_token=<token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "disable_fork": true,
    "forbidden_developer_create_branch": false,
    "forbidden_developer_create_tag": false,
    "show_branch_creator": true
  }'

JavaScript

const response = await fetch(
  "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/repo_settings?access_token=<token>",
  {
    method: "PUT",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      disable_fork: true,
      forbidden_developer_create_branch: false,
      forbidden_developer_create_tag: false,
      show_branch_creator: true,
    }),
  }
);

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

const data = await response.json();
console.log(data);

Python

import requests

resp = requests.put(
    "https://api.atomgit.com/api/v5/repos/<owner>/<repo>/repo_settings",
    params={"access_token": "<token>"},
    headers={"Content-Type": "application/json"},
    json={
        "disable_fork": True,
        "forbidden_developer_create_branch": False,
        "forbidden_developer_create_tag": False,
        "show_branch_creator": True,
    },
    timeout=10,
)
resp.raise_for_status()

print(resp.json())

Response example

Status code: 200

{
  "forbidden_developer_create_branch": true,
  "forbidden_developer_create_tag": true,
  "forbidden_committer_create_branch": true,
  "generate_pre_merge_ref": true,
  "forbidden_gitlab_access": true,
  "rebase_disable_trigger_webhook": true,
  "action_pipeline_enabled": true,
  "block_cross_repo_pr_trigger": true,
  "show_branch_creator": true
}

Error codes

Error code Description
400 Parameter error or the request cannot be parsed
401 Unauthenticated or invalid credentials
403 Forbidden; you do not have permission to perform this operation
404 The repository does not exist or the request path does not exist
429 Too many requests; rate limit triggered
500 Internal system error

Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc