# Depot Code

Depot Code is in public beta. Depot is rapidly iterating on it, including a UI for reviewing code and full API coverage. Functionality and capabilities could change, and documentation might be out of date. If you have suggestions to make Depot Code better, [reach out](/content/help/index.html) and let us know.

Create a Git repository hosted on Depot's diskless Git server, then clone, push, and fetch with regular `git` commands. Once your code is in Depot, you can trigger [Depot CI](/content/docs/ci/overview/index.html) workflows against it.

## Prerequisites

- A [Depot account](/content/sign-up/index.html).
- [Git](https://git-scm.com/) installed locally.
- Optional: [Connect to GitHub](/content/docs/ci/quickstart#connect-to-github/index.html) if you want to create a mirror repository in Depot Code. Check for an existing connection in your organization [**Settings**](/content/orgs/_/settings/index.html) under **GitHub Code Access**.

## Create a repository

Create a repository from the Depot dashboard.

1. In the Depot dashboard, under **Code**, click **Repositories**.
2. Click **Create repository**.
3. Choose the repository type:
   - **Standalone**: enter a repository name and a default branch name. Depot Code creates a fresh, empty repository for you to push your code to.
   - **Mirror**: import a GitHub repository so Depot can serve clones and fetches. GitHub remains the source of truth because pushes through Depot are forwarded to GitHub. Upstream changes are imported when the mirror is refreshed.

Repository names can include letters, numbers, dots, underscores, and hyphens, and can be namespaced with slashes, for example `team/service`.

To create and delete repositories programmatically, use the [Depot Code API](/content/docs/api/code-reference/index.html).

## Create an access token

Depot Code authenticates Git over HTTPS using a Depot access token as the password, with `x-token` as the username.

1. On the repository page in the Depot dashboard, click **Create access token**.
2. Copy the token immediately. For security, it's shown only once.

## Clone or push

Copy the repository's clone URL from the dashboard. It has the form `https://<org-id>.code.depot.dev/<repository>`, where your organization ID is the subdomain.

Clone a repository:

```
git clone https://x-token@<org-id>.code.depot.dev/<repository>
```

Or add Depot as a remote on an existing local repository and push:

```
git remote add depot https://x-token@<org-id>.code.depot.dev/<repository>
git push -u depot main
```

The `x-token` username tells Git to prompt only for a password. Paste your [access token](/content/docs/code/quickstart#create-an-access-token/index.html) when prompted. To avoid re-entering it on every fetch and push, configure a [Git credential helper](https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage).

Pushing to the Depot remote for a GitHub mirror repository also pushes those changes to GitHub. If you want Depot-only writes, create a standalone repository.

To trial Depot Code alongside GitHub, keep GitHub as your `origin` remote and add Depot as a second remote. Run `git remote -v` to list the remotes configured for the repository.

## Trigger Depot CI

Depot Code repositories work with [Depot CI](/content/docs/ci/overview/index.html). To run CI, add a workflow file to `.depot/workflows/` in your repository, for example `.depot/workflows/ci.yml`, using GitHub Actions YAML syntax, then commit and push it.

Depot Code repository events trigger CI only on `push`. When you push, Depot CI runs every workflow with an `on: push` trigger against the pushed commit.

To run a workflow without pushing, use [`depot ci run`](/content/docs/cli/reference/depot-ci#depot-ci-run/index.html). To select Depot Code in a checkout with GitHub or Origin remotes, add `--forge depot`.

Depot Code and Depot CI push triggers for standalone repositories are enabled by default for all organizations. Workflows that depend on GitHub-specific features may require changes.

For workflow syntax and supported features, see the [Depot CI quickstart](/content/docs/ci/quickstart/index.html) and [compatibility reference](/content/docs/ci/compatibility/index.html).
