---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://sourcecraft.dev/portal/docs/en/cli-ref/src-repo-fork.md
  - https://sourcecraft.dev/portal/docs/ru/cli-ref/src-repo-fork.md
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt

# src repo fork

Fork Repository

## Usage

`src repo fork [flags]`

### Examples

**Fork current repository to same organization**

`src repo fork --slug my-fork`

**Fork current repository to different organization**

`src repo fork --org otherorg --slug my-fork`

**Fork only default branch**

`src repo fork -R myorg/myrepo --default-branch-only=true`

### Flags

| Flag | Description |
| --- | --- |
| `-w, --web` | Open in browser after completion |
| `--org string` | Organization slug where the fork will be created (use either org_slug or org_id) |
| `--slug string` | Slug for the forked repository (up to 256 characters). If not specified, uses the source repository slug |
| `--default-branch-only` | Copy only the default branch. If false, all branches will be copied |

### Inherited flags

| Flag | Description |
| --- | --- |
| `--env string` | Override Sourcecraft environment (use 'src envs' to list available) |
| `--json string` | Output JSON, optionally filtered (--json or --json=field1,field2) |
| `--json-compact string` | Output compact JSON, optionally filtered |
| `-R, --repo string` | Select another repository using OWNER/REPO format |
| `-V, --verbose` | Enable debug logging output |

### Learn more

Use `src repo fork <subcommand> --help` for more information about a command.
