Перейти до основного вмісту

Repositories API

Create GitHub repositories and push code on behalf of your account via the connected GitHub App installation.

Prerequisite

All endpoints require the GitHub App to be installed on your account. If the app is not installed, requests return a 422 error with code GITHUB_APP_REQUIRED.

Endpoints

MethodPathScopeDescription
POST/api/reposrepos:writeCreate a new GitHub repository
POST/api/repos/pushrepos:writePush files to an existing repository
POST/api/repos/create_and_pushrepos:writeCreate a repository and push files in one call

Create Repository

POST /api/repos

Parameters:

NameTypeRequiredDefaultDescription
namestringRepository name
descriptionstringRepository description
privatebooleantrueWhether the repo is private
auto_initbooleanfalseInitialize with a README

Response (201):

{
"repo": {
"full_name": "octocat/hello-world",
"html_url": "https://github.com/octocat/hello-world",
"clone_url": "https://github.com/octocat/hello-world.git",
"ssh_url": "git@github.com:octocat/hello-world.git",
"private": true,
"default_branch": "main"
}
}

Example:

curl -X POST https://fibe.gg/api/repos \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "my-rails-app", "description": "A new Rails app", "private": true}'

Push Files

POST /api/repos/push

Push one or more files to an existing repository in a single atomic commit.

Parameters:

NameTypeRequiredDefaultDescription
repostringRepository full name (e.g., octocat/hello-world)
filesarrayArray of { path, content } objects
messagestringCommit message
branchstringdefault branchTarget branch

Response (200):

{
"commit_sha": "abc123...",
"tree_sha": "def456...",
"files_pushed": 3
}

Example:

curl -X POST https://fibe.gg/api/repos/push \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"repo": "octocat/my-rails-app",
"message": "Add initial structure",
"files": [
{ "path": "Gemfile", "content": "source \"https://rubygems.org\"\ngem \"rails\"" },
{ "path": "README.md", "content": "# My Rails App" }
]
}'

Create & Push

POST /api/repos/create_and_push

Creates a repository and pushes files in a single API call — useful for bootstrapping new projects.

Parameters:

NameTypeRequiredDefaultDescription
namestringRepository name
descriptionstringRepository description
privatebooleantrueWhether the repo is private
filesarrayArray of { path, content } objects
messagestring"Initial commit"Commit message

Response (201):

{
"repo": {
"full_name": "octocat/my-rails-app",
"html_url": "https://github.com/octocat/my-rails-app",
"clone_url": "https://github.com/octocat/my-rails-app.git",
"ssh_url": "git@github.com:octocat/my-rails-app.git",
"private": true,
"default_branch": "main"
},
"commit": {
"commit_sha": "abc123...",
"tree_sha": "def456...",
"files_pushed": 3
}
}

Error Codes

CodeHTTP StatusDescription
UNAUTHORIZED401Missing or invalid API key
FORBIDDEN403API key missing repos:write scope
GITHUB_APP_REQUIRED422GitHub App not installed on your account
VALIDATION_FAILED422Invalid or missing parameters
RESOURCE_NOT_FOUND404Repository not found (push)