> For the complete documentation index, see [llms.txt](/llms.txt).
> Markdown versions of each page are available by appending .md to any URL.

# Connecting other code forges to your factory

Connect a factory to a repository from another code forge using Agent Secrets and setup commands on the default runner.

Connect a factory to a repository on Bitbucket, Azure DevOps, self-managed GitLab, or another code forge without first-class factory support. Create the factory with no connected repository, then clone the repository from its default runner.

Caution

This setup gives factory agents repository access. It does not add provider-specific events or automations for that code forge.

## Prerequisites

-   **Permission to configure the factory** - Create the factory, add an Agent Secret, and edit its default runner.
-   **A repository access token** - Create a token that can read the repository. Use a service account where your code forge supports one, and grant only the permissions the factory needs.
-   **An authenticated clone command** - Use the HTTPS clone syntax your code forge documents. The command must read the token from an environment variable instead of including its value directly.

For provider-specific token and clone formats, see [Bitbucket repository access](/platform/integrations/bitbucket/), [Azure DevOps repository access](/platform/integrations/azure-devops/), or [self-managed GitLab repository access](/platform/integrations/gitlab/#self-managed-gitlab-instances).

## Create the factory without a repository

Start without a code-host connection so you can prepare the repository from the runner instead.

1.  In the [Warp Factories web app](https://platform.warp.dev), click **+** next to **Factories**.
2.  Under **Connect your code host**, select **No repo**.
3.  Complete the remaining setup choices to create the factory.

The factory opens in its dashboard without a connected repository.

## Grant the clone credential

Store the repository token as an Agent Secret so the default runner can use it without placing the token in a command or definition file.

1.  In the Warp Factories web app, open **Secrets** and create an Agent Secret named `CODE_FORGE_TOKEN`.
2.  Add the repository access token as the secret value.
3.  Grant `CODE_FORGE_TOKEN` to the factory agents that use the default runner.

The secret is available to those agents and their runner setup commands as the `CODE_FORGE_TOKEN` environment variable.

## Clone the repository from the default runner

Runner setup commands prepare each agent workspace before factory work starts.

1.  In the factory dashboard, open **Settings** > **Runners**.
2.  Open the default runner and add an authenticated `git clone` command that reads `$CODE_FORGE_TOKEN`.
3.  Add any project setup commands the repository needs, such as dependency installation, builds, or code generation.

Use your code forge’s documented clone format. For example, Bitbucket Cloud requires the `x-bitbucket-api-token-auth` username, while other hosts use a different username or authorization header.

Setup commands run each time the runner prepares a workspace. Make the commands safe to run repeatedly.

## Test repository access

Start a direct factory run before you connect another work source.

1.  In the factory dashboard, open **Runs** and click **New**.
    
2.  Send a read-only request such as:
    
    ```text title="Test repository access"
    In the repository root, list the top-level files and report the current
    branch. Do not change any files.
    ```
    
3.  Confirm that the run reports files from the cloned repository.
    

If the run cannot clone the repository, confirm that the Agent Secret is granted to the agent, the token has repository read access, and the clone command uses the token environment variable correctly.

## Starting work

This code forge cannot start factory work from its own repository events. Start work from a connected service such as [Slack](/factories/integrations/slack/), [Linear](/factories/integrations/linear/), or [Jira](/factories/integrations/jira/), through a [custom webhook](/factories/webhooks/), or with a direct factory run.

## Related pages

-   [Connect GitHub to your factory](/factories/integrations/github/) - Use GitHub’s first-class code-forge connection.
-   [Connect GitLab to your factory](/factories/integrations/gitlab/) - Use GitLab.com’s first-class code-forge connection.
-   [Connect your factory](/factories/connect-your-factory/) - Add the sources that start work after the repository is available.
-   [Cloud agent secrets](/platform/secrets/) - Store and scope credentials for cloud agents.
