---
title: "Import a Git repo into this Diversion repo"
method: POST
path: "/repos/{repo_id}/import"
tags: ["Repository Manipulation"]
---

# Import a Git repo into this Diversion repo

`POST /repos/{repo_id}/import`

Import a Git repo with all history from a Git URL. `repo_id` must have no commits and no branches, or be already marked as synced with the same `git_url`. The git repo URL must have http credentials embedded or otherwise hosted on Github and the owner has the Diversion Github app integration set up.

## Request body

- GitRepoImport — Details of a git repo to import into Diversion
  - `git_url` string — URL to the git repo. May be omitted if repo_id already has it set.

## Response `202`

Import started asynchronously. Poll the repo until it shows a default branch.

## Other responses

- `409` — An error occurred
- `422` — An error occurred
- `default` — An error occurred

---

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