Get project push rules¶
GET /api/v5/repos/{owner}/{repo}/push_config
Call this endpoint to get the project push rule configuration of the specified repository.
Supported 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 | Namespace address to which the repository belongs (address path of the organization or user) |
repo |
path | string | Yes | Repository path (path) |
access_token |
query | string | Yes | User authorization code |
Response parameters¶
| Field | Type | Always returned | Nullable | Description |
|---|---|---|---|---|
reject_not_signed_by_gpg |
integer | Yes | No | Whether to reject pushes that are not signed with GPG; value 0/1 |
deny_force_push |
integer | Yes | No | Whether to forbid force pushes; value 0/1 |
max_file_size |
integer | Yes | No | Maximum file size allowed in a push |
skip_rule_for_owner |
integer | Yes | No | Whether the push rules are skipped for the repository owner; value 0/1 |
Error response¶
The following are common error response examples; the specific error field names follow what the backend actually returns.
400 Invalid parameters
401 Unauthenticated
HTTP status codes¶
| Status code | Description |
|---|---|
200 |
Success (OK) |
401 |
Authentication required (Requires authentication) |
403 |
Access forbidden (Forbidden) |
404 |
Request path does not exist |
Request example¶
Parameter notes¶
Replace
<owner>with the namespace address to which the repository belongs (address path of the organization or user); replace<repo>with the repository path (path); replace<token>with your AtomGit user access token.
cURL¶
curl -X GET 'https://api.atomgit.com/api/v5/repos/<owner>/<repo>/push_config?access_token=<token>' \
-H 'Accept: application/json'
JavaScript¶
// Native fetch (Node.js 18+ / browsers)
const response = await fetch("https://api.atomgit.com/api/v5/repos/<owner>/<repo>/push_config?access_token=<token>", {
headers: {
"Accept": "application/json",
},
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
Python¶
import requests
resp = requests.get(
"https://api.atomgit.com/api/v5/repos/<owner>/<repo>/push_config",
params={"access_token": "<token>"},
headers={
"Accept": "application/json",
},
timeout=10,
)
resp.raise_for_status()
print(resp.json())
Response example¶
Status code: 200
{
"reject_not_signed_by_gpg": 0,
"deny_force_push": 0,
"max_file_size": 0,
"skip_rule_for_owner": 0
}
Error codes¶
| Error code | Description |
|---|---|
401 |
Unauthenticated or invalid credentials (missing or invalid access credentials) |
400 |
Invalid parameters or the request cannot be parsed |
403 |
Access forbidden (Forbidden) |
404 |
Request path does not exist |
Markdown source: View on AtomGit·Content from the open-source project gitcode-dev/atomgit-api-doc