---
title: "Create Git configuration"
method: POST
path: "/v1/models/{modelId}/git"
tags: ["Model Git configuration"]
---

# Create Git configuration

`POST /v1/models/{modelId}/git`

Create a new Git configuration for a shared model.

## Path parameters

- `modelId` string, uuid, required

## Request body

- object
  - `authMethod` 'ssh' | 'https_token' — The authentication method to use: - `ssh` for deploy key - `https_token` for deploy token/PAT
  - `cloneUrl` string, required — Clone URL of the git repository. Varies depending on the `authMethod`: - `ssh` - A string starting with `git@...` - `https_token` - A string starting with `https://...`
  - `sshUrl` string — **Deprecated. Use `cloneUrl` instead**. The SSH URL of the git repository.
  - `token` string — **Required when `authMethod: https_token`**. HTTPS token for authentication (deploy token value, PAT, etc.).
  - `baseBranch` string — The target branch for Omni pull requests.
  - `branchPerPullRequest` boolean — If `true`, all pull requests will create a branch in Omni, even those created outside of the tool.
  - `gitFollower` boolean — If `true`, the shared model is read-only and can only be updated by merging pull requests to the `baseBranch`.
  - `gitServiceProvider` 'auto' | 'github' | 'gitlab' | 'azure_devops' | 'bitbucket' | 'bitbucket_datacenter' — The git provider type. Use `auto` for automatic detection based on the SSH URL. - `auto` - Automatically detect the provider - `github` - GitHub - `gitlab` - GitLab - `azure_devops` - Azure DevOps - `bitbucket` - Bitbucket Cloud - `bitbucket_datacenter` - Bitbucket Data Center (self-hosted)
  - `modelPath` string — Path to model files within the repository.
  - `requirePullRequest` 'always' | 'users-only' | 'never' — Controls when pull requests are required for changes: - `always` - Required for all changes - `users-only` - Required only for user-initiated changes - `never` - Never required
  - `webUrl` string — Custom web URL for the git repository. Use when the `cloneUrl` goes through a tunnel/VPC and differs from the inferred HTTPS address.
  - `deployPrivateKey` string — **Applicable to SSH authentication**. Supply your own RSA or ED25519 private key in PEM format (OpenSSH, PKCS#1, or PKCS#8) instead of using an Omni-generated keypair. Authorize the matching public key with your first, then set it here. See [Rotate Git SSH keys with the API](/guides/api/rotate-ssh-deploy-keys) for step-by-step instructions.
  - `deployKeyPassphrase` string — **Applicable to SSH authentication.** Passphrase used to decrypt an encrypted `deployPrivateKey`. Omni uses it once to decrypt the key, then stores the key under its own encryption at rest. The passphrase itself is not retained. See [Rotate Git SSH keys with the API](/guides/api/rotate-ssh-deploy-keys) for step-by-step instructions.

## Response `200`

Git configuration created successfully

- ModelGitConfig
  - `authMethod` 'ssh' | 'https_token' — Authentication method. `ssh` for deploy key, `https_token` for deploy token/PAT.
  - `cloneUrl` string — Clone URL of the git repository (SSH or HTTPS)
  - `baseBranch` string — The target branch for Omni pull requests.
  - `branchPerPullRequest` boolean — If `true`, all pull requests will create a branch in Omni, even those created outside of the tool.
  - `gitFollower` boolean — If `true`, the shared model is read-only and can only be updated by merging pull requests to the base branch.
  - `gitServiceProvider` 'github' | 'gitlab' | 'azure_devops' | 'bitbucket' — The git provider type. - `github` - GitHub - `gitlab` - GitLab - `azure_devops` - Azure DevOps - `bitbucket` - Bitbucket
  - `modelPath` string, nullable — Path to model files in the repository.
  - `publicKey` union — SSH public key for repository access (deploy key). Null for HTTPS token auth (`authMethod: https_token`).
    - string
    - unknown
  - `requirePullRequest` 'always' | 'users-only' | 'never' — Controls when pull requests are required for changes: - `always` - Required for all changes - `users-only` - Required only for user-initiated changes - `never` - Never required
  - `sshUrl` string — **Deprecated. Use `cloneUrl` instead**. SSH URL of the git repository.
  - `webUrl` string, nullable — Custom web URL for the git repository, or null if not set.
  - `webhookSecret` string — Webhook secret for signature verification. Only included if requested via `?include=webhookSecret`.
  - `webhookUrl` string — Webhook URL to configure in your git provider.

## Other responses

- `400` — Bad Request Possible error messages: - `Bad Request: modelId: Invalid uuid` - `Bad Request: sshUrl is required` - `Bad Request: Invalid sshUrl format` - `Bad Request: Invalid requirePullRequest value` - `Bad Request: deployPrivateKey: Invalid key format` - `Bad Request: deployPrivateKey: Wrong passphrase` - `Bad Request: deployPrivateKey: Encrypted key requires deployKeyPassphrase` - `Bad Request: deployKeyPassphrase cannot be provided without deployPrivateKey` - `Bad Request: deployPrivateKey not supported with authMethod: https_token`
- `401` — Missing or invalid authentication
- `403` — Forbidden Possible error messages: - `Forbidden: Requires MANAGE_MODEL permission`
- `404` — Not Found Possible error messages: - `Not Found: Model does not exist`
- `409` — Conflict Possible error messages: - `Conflict: Git configuration already exists for this model`
- `429` — Too Many Requests - Rate limit exceeded (60 requests/minute)

---

[API](https://skmtc.net/omni/apis/omni-api.md) · [All operations](https://skmtc.net/omni/apis/omni-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/omni/omni-api/versions/6b02f7349d0e/schema)
