Page kind: Reference
swarmops clone#
Make a store from a git remote: a new store in --into, the remote recorded as --remote (origin), fetched, and its followed branch (--branch, else the remote's default branch) imported into main.
The URL is an https or ssh URL, or the scp form user@host:path; a plain http URL only to a loopback address. A URL holding a password is refused, and so is an http or https URL with a user part, whatever the user is: a token there cannot be told from a name (leave the token to git's credential helper, or name its variable with --token-env). An ssh URL keeps its user. Git 2.39 or later runs the transfer, with the user's own credentials, proxies and ssh configuration. It needs an identity, as git import does: it moves main. Run again into the same directory with the same URL, it continues an interrupted clone.
- Group
remotes- Since
0.2.0- Mutates
- yes
- Identity required
- yes
- MCP tool
- none
- Envelope op
clone_repo- Exit codes
- 0
- Errors
- none
Syntax#
swarmops clone [OPTIONS] --into <DIR> <URL>Required arguments#
Syntax: <URL>.
The remote's URL.
Syntax: --into <DIR>.
The directory to make the store in: absent or empty.
Optional arguments#
The command also takes the global options.
Syntax: --name <NAME>.
The repository's name (default: the URL's last path component, without .git).
Syntax: --branch <BRANCH>.
The remote branch main follows (default: the remote's default branch).
Syntax: --remote <NAME>.
Default: origin.
The name to record the remote under.
Syntax: --token-env <VAR>.
The environment variable that holds a token for the remote, by its name.
Syntax: --lossy <CLASS>....
A class of content the import may drop or normalize, as git import's. Values: gitlinks: A submodule's entry: dropped; paths: A name that is no path component: not UTF-8, . or .., empty, or holding a /: dropped; modes: A mode git does not write, such as 100664: normalized; tree_order: A tree out of git's order, or naming an entry twice: put in order; empty_trees: An entry naming an empty tree: dropped; nonstandard: A commit whose bytes the changeset cannot keep: kept as its fields hold it; all: Every class.
Examples#
No recorded example yet.
Return information#
result is a CloneResp (swarmops schema CloneResp prints its JSON Schema).
| Field | Type | Required | Description |
|---|---|---|---|
fetch | FetchResp | yes | The clone's fetch. |
imported | integer | yes | How many changesets the import into main added. |
main | string or null | no | The changeset main names; omitted when the remote is empty. |
remote | RemoteInfo | yes | The remote recorded. |
repo | RepoInfo | yes | The new store. |
Envelope op: clone_repo.
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, E_IO or E_STORE_CORRUPT; a command line the grammar refuses is E_INVALID_ARG (exit 2).