---
title: "Create an empty repository through one of your git connections"
method: POST
path: "/git-connections/{connection_id}/repositories"
tags: ["Git Provider Connections"]
---

# Create an empty repository through one of your git connections

`POST /git-connections/{connection_id}/repositories`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/git-connections/{connection_id}/repositories`
- Auth: HTTP bearer

Uses the token of a connection you own, so the repository is created as
you and with exactly the access that token has. Another user's connection
answers 404. Pushing code into the new repository is a separate step.

## Path parameters

- `connection_id` integer, required

## Request body

- CreateRepositoryRequest: Request body for creating an empty repository through a git connection.
  - `description` string, nullable: Short description, up to 350 characters.
  - `name` string, required: Repository name: letters, digits, `-`, `_` and `.`, up to 100 characters.
  - `owner` string, nullable: Account or organization to create it under. Defaults to the connection's own account.
  - `private` boolean: Whether the repository is private. Defaults to `true`.

## Response `201`

Repository created

- CreatedRepositoryResponse: The repository that was created. Carries no credentials.
  - `clone_url` string, required
  - `connection_id` integer, required
  - `default_branch` string, required
  - `full_name` string, required
  - `name` string, required
  - `owner` string, required
  - `private` boolean, required
  - `web_url` string, required

## Other responses

- `400`: Invalid name, owner or description, or the connection is inactive
- `401`: Unauthorized
- `403`: Insufficient permissions
- `404`: Connection not found, or not owned by the caller
- `409`: A repository with that name already exists
- `502`: The git provider rejected or failed the request

## Changes

> 81 revisions in range; 1 not diffed.

- **2026-10-20** `79089e9f49ee`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/git-connections/:connection_id/repositories/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) · [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) · [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/ab6d5d19e930?raw)
