---
title: "Create git repository"
method: POST
path: "/v2/integrations/git/{providerId}/create-repo"
tags: ["Users"]
---

# Create git repository

`POST /v2/integrations/git/{providerId}/create-repo`

## Request

- Base URL: `https://api.apify.com`
- URL: `https://api.apify.com/v2/integrations/git/{providerId}/create-repo`
- Auth: one of:
  - HTTP bearer
  - API key in query parameter `token`

Creates a repository through a connected git account and commits the initial files into it, either the given
`files` or the files of an Actor template archive (`templateArchiveUrl`).

## Path parameters

- `providerId` string, required

## Request body

- CreateGitRepoRequest
  - `workspace` string, required: Where to create the repository, as the `id` of one of the provider's workspaces. On GitLab, this is the numeric namespace ID.
  - `repoName` string, required
  - `isPrivate` boolean, required
  - `files` GitRepoFile[]: Files to commit as the initial commit. Can't be combined with `templateArchiveUrl`.
    - `path` string, required
    - `content` string, required
    - `encoding` 'utf-8' | 'base64', required
  - `templateArchiveUrl` string: URL of an Actor template archive whose files are committed as the initial commit. Can't be combined with `files`.

## Response `201`

- GitRepoResponse
  - `data` GitRepo, required: URLs of a newly created repository.
    - `sshUrl` string, required
    - `httpsUrl` string, required
    - `htmlUrl` string, required

## Other responses

- `400`: Bad request - invalid input parameters or request body.
- `401`: Unauthorized - authentication required or invalid token.
- `403`: Forbidden - insufficient permissions to perform this action.
- `404`: Not found - the requested resource does not exist.
- `405`: Method not allowed.
- `413`: Payload too large - the request body exceeds the size limit.
- `415`: Unsupported media type - the Content-Encoding of the request is not supported.
- `429`: Too many requests - rate limit exceeded.

## Changes

> 25 revisions in range; 1 not diffed.

- **2026-10-27** `ec76185eb934`: 8 info
  - added the optional property `error/data` to the response with the `400` status
  - added the optional property `error/data` to the response with the `401` status
  - added the optional property `error/data` to the response with the `403` status
  - added the optional property `error/data` to the response with the `404` status
  - …4 more
- **2026-10-27** `e52dd2239cee`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/apify/apis/apify-api/changes/v2/integrations/git/:providerId/create-repo/post.md)

---

[API](https://skmtc.dev/apify/apis/apify-api.md) - [All operations](https://skmtc.dev/apify/apis/apify-api/llms.txt) - [OpenAPI document](https://skmtc.dev/apify/apis/apify-api/revisions/68d2d102e6a2?raw)
