Tugboat CLI Commands

This page lists every Tugboat CLI command, with an example of each. For step-by-step tasks, see Use the CLI.

To see this information in your terminal, run tugboat help [command]. If a command fails with an error code, see Tugboat Error Codes.

Most commands take their arguments as key=value pairs, for example repo=[repo_id]. In the examples, replace each placeholder in brackets, such as [preview_id], with your own value.

Each command shows the lowest access level that can run it. Your access level is your user permission level on the Project or Repository that the command works on. Each level can do everything the levels below it can do: Read-only, then User, then Admin, then Owner. See User Permission Levels. A sandbox Access Token can run fewer commands. See Access Token roles.

Global options

You can use these options with any command.

Option Description
-u, --api-url <url> The URL of the Tugboat API. The default is https://api.tugboatqa.com.
-p, --proxy <url> The URL of an HTTP or HTTPS proxy to use for API connections.
-t, --api-token <token> The Access Token to use. You can also set the TUGBOAT_API_TOKEN environment variable.
-k, --no-check-certificate Don’t verify the API certificate when using HTTPS.
-q, --quiet Show no output. Return only an object ID or status code.
-v, --verbose Show more detailed output. Ignored with --quiet.
-j, --json Show the API output as raw JSON. Ignored with --quiet or --verbose.
-w, --write [path] Write the API output to a file. Overrides --quiet, --verbose, and --json.
--debug Show debug output. Ignored with --quiet.
-f, --force Try to force an operation. This is the same as passing force=true.
--no-color Turn off color in the output.
-b, --browser [browser] Open the new Preview’s URL in your default browser, or in the browser you name. Works with create preview and clone.
--tree Show the output as a tree.
-V, --version Show the version of the CLI.
-h, --help Show the help for a command.

For example, to list your Previews as JSON:

1tugboat ls previews --json

The CLI settings file

The CLI reads its settings from the .tugboat.yml file in your home directory. This is different from the Tugboat config file in your git repository. tugboat login creates .tugboat.yml for you. See Set an Access Token.

Setting Description
token The Access Token to use.
api The URL of the Tugboat API. The default is https://api.tugboatqa.com.
dashboard The HTTPS URL of the Tugboat dashboard. tugboat login uses it.
proxy The URL of an HTTP or HTTPS proxy to use for API connections.
insecure Set to true to skip verifying the API certificate when using HTTPS. Default: false.
1token: "[your_access_token]"
2api: "https://api.tugboatqa.com"
3insecure: false

When you run tugboat link in a git checkout, the CLI saves the IDs of a Repository, a Base Preview, and a Preview in the checkout’s .git/config file. The CLI’s messages call these worktree bindings. Commands that you run in that checkout use these links when you leave out an ID:

Link Used by
tugboat.repo create preview, list branches, list pulls, list tags, and list user
tugboat.base create preview, as the Base Preview
tugboat.preview clone, find, log, output, rebuild, refresh, reset, shell, start, statistics, stop, suspend, and update

If the CLI can’t find a linked Repository, it looks for a Tugboat Repository that matches the checkout’s git remotes. If exactly one matches, the CLI uses it and links it.

tugboat cancel

Access levelUser or higher

Cancel a Preview that is building, refreshing, or cloning. Tugboat deletes the Preview’s containers and marks the Preview as cancelled. See Preview status.

1tugboat cancel [preview_id]

tugboat clone

Access levelUser or higher

Clone a Preview. If you leave out the ID, the CLI uses the linked Preview. See Duplicate a Preview.

Argument Description
name A name for the new Preview.
expires When to delete the new Preview automatically, for example 2026-12-31 or 2026-12-31T13:00:00. Times without a time zone are in UTC. If you leave it out, the Repository’s Preview expiration setting is used.
1tugboat clone [preview_id] name="Copy for QA"

tugboat create

Create a Tugboat object. The first argument is the type of object.

1tugboat create [type] [arguments]

tugboat create preview

Access levelUser or higher

Build a new Preview from a git ref, such as a branch, tag, commit, or pull request number. See Build Previews.

Argument Description
repo The Repository ID. In a linked checkout, you can leave it out.
type The type of ref: branch, tag, commit, pullrequest, or mergerequest. Use it when Tugboat guesses wrong, for example when a tag and a branch have the same name.
base The ID of the Preview to use as the Base Preview. Set to false to build without a Base Preview. If you leave it out, Tugboat uses an anchored Base Preview, if there is one.
name A name for the Preview. If you leave it out, Tugboat uses the ref, or the title of the pull request or merge request.
config The path to a local YAML file to use instead of the config file in the git repo.
expires When to delete the Preview automatically. Uses the same formats as tugboat clone.
anchor Set to true to make the new Preview a default Base Preview for the Repository.
anchor_type repo (the default) uses the Base Preview for all new Previews in the Repository. branch uses it only for pull requests and merge requests into the branch it was built from.
1tugboat create preview main repo=[repo_id]

When you create a Preview in a linked checkout, the CLI links the new Preview.

To try a config file before you commit it, see Tugboat CLI config file argument. For base, anchor, and anchor_type, see How Base Previews work and Set a Base Preview.

tugboat create key

Access levelNone needed

Create an Access Token. Set role to full (the default) or sandbox. You can’t change the role later. See Access Token roles.

An Access Token belongs to your Tugboat account, not to a Project.

1tugboat create key "CI token"

tugboat create repo

Access levelAdmin or higher

Add a Repository to a Project. For what each Repository setting does, see Select Repository Settings.

1tugboat create repo "My Repo" project=[project_id]

tugboat create repo accepts the same settings as tugboat update does for a Repository.

tugboat create registry

Access levelAdmin or higher

Connect a Docker registry to a Repository. If you leave out serveraddress, Docker Hub is used. You can also set email. See Authenticate with a Docker Registry.

1tugboat create registry [repo_id] username=[username] password=[password] serveraddress=registry.example.com

tugboat create screenshot

Access levelUser or higher

Take a Screenshot of a Service. Optional arguments: url (default /), screen (desktop, tablet, or mobile), alias, fullPage, timeout (in seconds, from 1 to 300), and waitUntil. See Specify screenshot and visualdiff settings explicitly.

1tugboat create screenshot [service_id] url=/about screen=mobile

If the Service already has a Screenshot with the same settings, the CLI returns that Screenshot instead of taking a new one. To take it again, rebuild it:

1tugboat rebuild [screenshot_id]

tugboat create visualdiff

Access levelUser or higher

Compare a Screenshot with a base Screenshot. Use threshold to set how similar, as a percent, the Screenshots must be to pass. See Configure Visual Diffs.

1tugboat create visualdiff [screenshot_id] base=[base_screenshot_id]

tugboat create lighthouse

Access levelUser or higher

Create a Lighthouse report for a Service. Optional arguments: url (default /), screen (desktop or mobile), alias, base, threshold, and tolerance. See Use Lighthouse Thresholds.

1tugboat create lighthouse [service_id] url=/ screen=mobile

If the Service already has a report for that URL and screen, Tugboat updates that report instead of creating a new one. Reports you create with the CLI last until the Preview builds, rebuilds, or refreshes.

tugboat delete

Access levelUser or higher. Admin or higher for Projects, Repositories, and Docker registries.

Delete a Tugboat object, such as an Access Token, Project, Repository, Preview, Screenshot, Visual Diff, Lighthouse report, mail message, or Docker registry. The alias is tugboat rm. See Delete Previews.

You don’t need an access level to delete your own Access Tokens.

1tugboat delete [preview_id]

Before it deletes a Project or Repository, the CLI asks you to confirm. To skip the question, add --force.

Warning

Deleting a Project with the CLI doesn’t cancel its subscription. To delete a Project on a paid plan, use the dashboard. See Delete your project.

tugboat find

Access levelRead-only or higher

Show what an ID belongs to, and its details. If you leave out the ID, the CLI uses the linked Preview.

1tugboat find [id]

tugboat grant

Access levelAdmin or higher

Give Access Tokens access to a Project or Repository. Use users, admins, or guests (read-only), with one Access Token ID or a comma-separated list with no spaces. For what each level allows, see User Permission Levels.

1tugboat grant [repo_id] users=[access_token_id]

Access levelRead-only or higher

Link a git checkout to a Repository, and optionally to a Base Preview or Preview. You must run it inside a git checkout. See Checkout links.

Usage What it does
tugboat link Show the current links. If there are none, link the Repository that matches the git remotes, or choose one from a list.
tugboat link [repo_id] Link a Repository. --repo=[repo_id] and repo=[repo_id] do the same.
tugboat link --browse Choose a Repository from a list of your Projects and Repositories.
tugboat link base=[preview_id] Link a Base Preview. Also links its Repository, if none is linked.
tugboat link preview=[preview_id] Link a Preview. Also links its Repository, if none is linked.
1tugboat link [repo_id] base=[preview_id]

tugboat list

Access levelRead-only or higher

Show the details of a Tugboat object, or list a set of objects. The alias is tugboat ls.

The CLI shows only the objects you can access. Listing branches, pulls, tags, user, or registries needs User or higher. Listing the jobs of a Docker registry needs Admin or higher.

1tugboat ls [id]
2tugboat ls [set] [arguments]

You can list these sets: jobs, keys, lighthouse, mail, previews, projects, registries, repos, screenshots, services, and visualdiffs. Filter a set with arguments, such as repo=[repo_id] or preview=[preview_id]. For the filters each set accepts, see the Tugboat API docs.

1tugboat ls services preview=[preview_id]

For a Repository, you can also list branches, pulls, tags, and user (the git provider user the Repository is authorized with). For GitHub, GitLab, and Bitbucket Cloud, use page and per_page to page through the results.

1tugboat ls pulls [repo_id] page=2

To list the jobs of an object, such as a Preview:

1tugboat ls jobs [preview_id]

tugboat log

Access levelRead-only or higher

Show the log of a Preview or Service. To keep watching the log for new entries, add -a or --attach. If you leave out the ID, the CLI uses the linked Preview. See Preview log.

1tugboat log [preview_id] --attach

tugboat login

Access levelNone needed

Sign in with your browser, and save an Access Token to .tugboat.yml. See Set an Access Token.

Option Description
--dashboard <url> The HTTPS URL of the Tugboat dashboard, for Tugboat On-Premise. You can also set the TUGBOAT_DASHBOARD environment variable, or the dashboard setting in .tugboat.yml.
--no-browser Print the sign-in URL instead of opening a browser.
1tugboat login

tugboat output

Access levelRead-only or higher

Show everything a Service’s container has written to standard output and standard error. To see the build log instead, use tugboat log. If you pass a Preview ID, or leave out the ID to use the linked Preview, the CLI uses the Preview’s default Service. In the dashboard, this is the Service Output. See Click into Services to view build and output logs.

1tugboat output [service_id]

tugboat rebuild

Access levelUser or higher

Rebuild a Preview, Screenshot, Visual Diff, or Lighthouse report. If you leave out the ID, the CLI uses the linked Preview. See Change or Update Previews.

Argument Description
force Rebuild a Base Preview that has child Previews, or a Preview whose state doesn’t allow a Rebuild. Also releases the lock of an unfinished job on the Preview.
keepContainers Set to false, with force=true, to re-create the containers of a Preview in Review mode. This discards the content changes made in the Preview.
1tugboat rebuild [preview_id]

To rebuild all of the Screenshots, Visual Diffs, or Lighthouse reports of an object, such as a Preview:

1tugboat rebuild screenshots [preview_id]
2tugboat rebuild visualdiffs [preview_id]
3tugboat rebuild lighthouse [preview_id]

To rebuild only the Visual Diffs or Lighthouse reports with a certain status, add status. For Visual Diffs, the status can be failed, errored, or passed. For Lighthouse reports, it can also be approved or rejected.

1tugboat rebuild lighthouse [preview_id] status=failed

tugboat refresh

Access levelUser or higher

Refresh a Preview. Tugboat pulls the latest code, then runs the update and build commands from the config file. This is mainly for Base Previews. If you leave out the ID, the CLI uses the linked Preview. See Change or Update Previews.

You can’t refresh a Preview that was built from a Base Preview, unless it is a Base Preview itself. Rebuild it instead. A Preview in Review mode can only be refreshed with force=true.

1tugboat refresh [preview_id]

tugboat rekey

Access levelUser or higher

Make a new random token for a Preview’s URL. The Preview’s old URL stops working.

1tugboat rekey [preview_id]

tugboat reset

Access levelUser or higher

Reset a Preview or Service to how it was right after its last successful build, Rebuild, or Refresh. If you leave out the ID, the CLI uses the linked Preview. See Change or Update Previews.

A Preview in Review mode that has not failed can only be reset with force=true.

1tugboat reset [preview_id]

tugboat revoke

Access levelAdmin or higher

Take away Access Tokens’ access to a Project or Repository. Use users or admins, with one Access Token ID or a comma-separated list with no spaces. Revoking admins access makes the Access Token a user. To remove all access, revoke both. See User Permission Levels.

1tugboat revoke [repo_id] admins=[access_token_id] users=[access_token_id]

tugboat shell

Access levelUser or higher

Open a shell in a Service, or run a command in it. If you pass a Preview ID, the CLI uses the Preview’s default Service. If you leave out the ID, the CLI uses the linked Preview. See Run commands in a Service. To debug a config file with it, see Debug via Tugboat’s CLI.

Argument Description
command A command to run instead of opening a shell. A string is split on spaces. A JSON array is passed as is.
shell Set to true to run a string command with bash -c, or sh -c if Bash isn’t installed, so pipes, redirects, and quoting work.
tty Set to false to run without a terminal, so standard output and standard error stay separate. By default, the CLI uses a terminal when you run it in one.

The CLI exits with the exit code of the command. If Tugboat can’t run the command, or the connection closes before the command finishes, the CLI exits with code 125.

1tugboat shell [service_id] tty=false shell=true command='echo out; echo err >&2'

tugboat start

Access levelUser or higher

Start a Preview that is stopped or suspended. If you leave out the ID, the CLI uses the linked Preview. See Preview status.

1tugboat start [preview_id]

tugboat statistics

Access levelUser or higher

Show historical statistics for a Project, Repository, Service, or Preview. The alias is tugboat stats. If you leave out the ID, the CLI uses the linked Preview. See Preview Statistics.

The statistic can be size, repos, previews, services, build-time, or refresh-time. Filter the results with after and before (ISO 8601 dates), and limit.

1tugboat statistics [repo_id] size after=2026-11-01

tugboat stop

Access levelUser or higher

Stop a running Preview. Unlike a suspended Preview, a stopped Preview doesn’t start again when its URL gets a request. It stays offline until you run tugboat start. To keep a Preview online but stop it from changing, lock it with tugboat update [preview_id] locked=true. The dashboard doesn’t offer Stop. If you leave out the ID, the CLI uses the linked Preview. See Preview status.

1tugboat stop [preview_id]

tugboat suspend

Access levelUser or higher

Suspend a running Preview. Tugboat also suspends Previews automatically after a period of inactivity. If you leave out the ID, the CLI uses the linked Preview. See Preview status.

1tugboat suspend [preview_id]

Access levelNone needed

Remove links from a git checkout. Name the link to remove: repo, base, preview, or all. If you leave it out, the CLI removes all of them.

tugboat unlink changes only your git checkout.

1tugboat unlink preview

tugboat update

Change a Tugboat object. If you leave out the ID, the CLI uses the linked Preview.

1tugboat update [id] [arguments]

Update a Preview

Access levelUser or higher

Argument Description
name A name for the Preview.
locked Set to true to lock the Preview, or false to unlock it.
mode development or review. See Preview Modes. Switching from review to development needs force=true.
anchor Set to true to make the Preview a default Base Preview for its Repository.
anchor_type repo or branch. See tugboat create preview.
config The path to a local YAML file to use instead of the config file in the git repo.
expires When to delete the Preview automatically. Uses the same formats as tugboat clone. Set to null to remove it. A date that you set also applies to a Base Preview. See Auto-delete Previews.
1tugboat update [preview_id] mode=review

Update a Repository

Access levelAdmin or higher

You can change any Repository setting, such as autobuild, autorebuild, expire_days, envvars, or refresh_hour. For what each setting does, see Select Repository Settings. For the full list, run tugboat help update, or see the Repositories API docs. For expire_days, see Auto-delete Previews.

To set environment variables for every Service in the Repository, use envvars. To limit them to build time or run time, use buildvars or runvars instead. See Create Custom Environment Variables.

admins, users, guests, envvars, buildvars, runvars, ip_allow, and ip_deny replace the whole list. To add or remove one Access Token, use tugboat grant or tugboat revoke instead.

1tugboat update [repo_id] expire_days=30

Update other objects

Access levelUser or higher. Admin or higher for Docker registries.

  • Access Token: name
  • Lighthouse report: approved, threshold, and tolerance. See Use Lighthouse Thresholds.
  • Mail message: read (true or false). See Captured mail.
  • Docker registry: username, password, serveraddress, and email

You don’t need an access level to update your own Access Tokens.

1tugboat update [lighthouse_id] approved=true

tugboat validate

Access levelNone for a local file. User or higher for a Repository.

Check whether a Tugboat config file is valid. Pass a local file, or a Repository ID and a git ref to check the config file at that ref. If the file is valid, the CLI shows the config as JSON, the way Tugboat reads it. If it isn’t, the CLI shows the error and exits with code 1. See Tugboat Configuration and Debugging Configuration files.

1tugboat validate .tugboat/config.yml
2tugboat validate [repo_id] main

tugboat version

Access levelNone needed

Show the version of the CLI and of the Tugboat server it connects to.

1tugboat version