# swarmops remote set

> Release: 0.13.0 · Last changed: 2026-11-29 · Source: https://github.com/KeiaiLab/SwarmOps/blob/stable/docs/reference/commands/remote-set.md

Name, change or clear the forge a remote lives on, and its token's source.

--forge (github, forgejo or gitea) and --api, which come together, record the forge and the base address of its API: https, or http to a loopback address, with no user part, query or fragment, and at most 255 bytes. --no-forge forgets both, and the remote is a plain git remote again. --token-env names the variable that holds the remote's token, or --token-file the file, by an absolute path, in place of the source the remote names; --no-token forgets it. A token file serves the forge's API alone, so it needs a forge; the file is not opened here. Nothing else of the remote changes: its URL and its branch are changed by remote remove and remote add, which also drop the mirror's refs of it. A so:// remote takes no forge. No request is made. It needs no identity.

```yaml
title: "swarmops remote set"
description: "Name, change or clear the forge a remote lives on, and its token's source."
group: "remotes"
since: "0.14.0"
mutates: true
identity_required: false
mcp_tool: ""
envelope_op: "remote_set"
exit_codes: [0]
errors: []
syntax: "swarmops remote set [OPTIONS] <NAME>"
```

## Syntax

```text
swarmops remote set [OPTIONS] <NAME>
```

## Required arguments

### `NAME`

Syntax: `<NAME>`.

The remote's name.

## Optional arguments

The command also takes the [global options](../cli.md#global-options).

### `--forge`

Syntax: `--forge <KIND>`.

The forge the remote lives on: github, forgejo or gitea. Comes with --api. Values: `github`: GitHub; `forgejo`: Forgejo; `gitea`: Gitea.

### `--api`

Syntax: `--api <ADDRESS>`.

The base address of the forge's API: https, or http to a loopback address, with no user part, query or fragment. Comes with --forge.

### `--no-forge`

Syntax: `--no-forge`.

Forget the remote's forge and API address.

### `--token-env`

Syntax: `--token-env <VAR>`.

The environment variable that holds the remote's token, by its name.

### `--token-file`

Syntax: `--token-file <PATH>`.

The file that holds the token of the forge's API, by an absolute path.

### `--no-token`

Syntax: `--no-token`.

Forget the remote's token variable or token file.

## Examples

### CLI

No recorded example yet.

## Return information

`result` is a `RemoteInfo` (`swarmops schema RemoteInfo` prints its JSON Schema).

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `api` | `string or null` | no | The base address of the forge's API, as recorded; omitted when the remote names no forge. |
| `branch` | `string` | yes | The remote branch `main` follows. |
| `forge` | `string or null` | no | The forge the remote names, as written in `remotes.toml`: `github`, `forgejo` or `gitea`, or a word a later build wrote; omitted for a plain git remote. |
| `lossy` | `array of LossyClass` | yes | The classes of content the import of this remote's commits may drop or normalize. |
| `name` | `string` | yes | The remote's name. |
| `token_env` | `string or null` | no | The environment variable that holds a token for the remote, by its name; omitted when the remote names none. |
| `token_file` | `string or null` | no | The file that holds the token of the forge's API, by its path on the caller's host; omitted when the remote names none. The token itself is in no result. |
| `url` | `string` | yes | The remote's URL, as it was given. |
| `warnings` | `array of string or null` | no | What adding the remote has to say that did not stop it, such as `default_branch_unknown` (the remote named no default branch, so `branch` is `main`). Omitted when there is nothing. |

Envelope `op`: `remote_set`.

Exit codes:

- `0`: Success.

## Errors

No golden step shows this command failing yet.

Any command that opens a store may also fail with a store error, such as [`E_NOT_A_REPO`](../errors.md#e_not_a_repo), [`E_IO`](../errors.md#e_io) or [`E_STORE_CORRUPT`](../errors.md#e_store_corrupt); a command line the grammar refuses is [`E_INVALID_ARG`](../errors.md#e_invalid_arg) (exit 2).

## See also

- [`swarmops clone`](clone.md)
- [`swarmops remote add`](remote-add.md)
- [`swarmops remote remove`](remote-remove.md)
- [`swarmops remote list`](remote-list.md)
- [`swarmops fetch`](fetch.md)
- [`swarmops push`](push.md)
- [`swarmops sync`](sync.md)
- [`swarmops sync status`](sync-status.md)
- [CLI reference](../cli.md)
- [Error codes](../errors.md)
