Skip to content
Stash Commands

Stash Commands

Last updated:

The Camber CLI provides several commands to manage your files in Camber Stash. This page covers the most common stash operations: listing, copying, and removing files.

Upload files with an AI coding agent

Hand this prompt to your AI coding agent, along with the file or folder you want to upload. It confirms the destination, skips sensitive and generated files, uploads, and verifies the result.

Upload files to Camber Stash
# Upload Files to Camber Stash

Upload the files or folder the user names to Camber Stash and confirm they arrived.

## What Camber Stash is

Camber Stash is cloud file storage for Camber. Paths use the `stash://` scheme:

- `stash://<username>/...`: the user's private stash
- `stash://<team-name>/...`: a team stash the user belongs to
- `stash://public/...`: read-only public files

Docs: https://docs.cambercloud.com/docs/camber-cli/stash/index.md

## Before you start

Run `camber me`. It shows the user's username and team unique names. If the CLI is missing or the user is not logged in, point them to https://docs.cambercloud.com/docs/camber-cli/installation/index.md and stop.

## Step 1: Choose the source and destination

- Source: the local file or folder the user named. If they did not name one, ask.
- Destination: the stash path the user named. If they did not name one, propose their private stash, `stash://<username>/<folder-name>/`, unless they mentioned a team, and confirm it with the user.

Run `camber stash test -e <destination>`. It prints `true` or `false`, and exits 0 either way. If it prints `true`, the destination already exists: tell the user and ask before writing to it.

## Step 2: Check what will be uploaded

For a folder, list what will be uploaded after excludes. Point out anything that looks sensitive, such as `.env*` files, keys, or credentials, and any file larger than about 1 GB. Wait for the user to confirm.

## Step 3: Upload

A single file:

```bash
camber stash cp <local-file> <destination>
```

A folder:

```bash
camber stash cp -r <local-folder> <destination> \
  --use-gitignore \
  --exclude ".git/**" \
  --exclude ".env*" \
  --exclude "node_modules/**" \
  --exclude ".venv/**"
```

This copies the contents of `<local-folder>` into `<destination>`. Add an `--exclude` for anything else the user asked to skip.

## Step 4: Verify

Run `camber stash ls -r -a <destination>` and report what is there. Without `-a`, `ls` hides dotfiles such as `.gitignore`.

## Critical rules

- Never run `camber stash rm`. Deleting from Stash is permanent. If the user wants to delete something, give them the command to run themselves.
- `stash://public/` is read-only. Do not upload there.
- Do not upload `.env*` files, keys, or credentials unless the user explicitly approves it.
- If a command fails, show the user the exact error and stop. Do not guess or work around it.

## After upload

Tell the user the files are in their Camber Stash, and that they can download them later with `camber stash cp -r <destination> <local-folder>`.

Or run the commands yourself, as described below.

Listing Files and Directories

Use the camber stash ls command to list files and directories in your stash.

When executing the camber stash ls command without any arguments, it will list all files in the base directory your user stash.

To list files in a subdirectory provide the complete path:

camber stash ls stash://your-username/path

You can also list all the files in the directories of a stash location by setting the recursive flag -r.

camber stash ls -r stash://your-username/path

If you have a large number of files or directories in your stash this may take a moment. Flags: –recursive, -r bool List files and directories recursively (default: false) –all, -a bool Include hidden files and directories (default: false) –output string Output format: json


### Examples

List files in the `demos` subdirectory in your Stash

```bash
camber stash ls stash://your-username/demos

Output:

Name                                     Type                 Size
----                                     ----                 ----
.git                                     directory
10-get-started                           directory
20-tutorials                             directory
30-applications                          directory
.gitignore                               file                 46B
README.md                                file                 118B

Recursively list all files in your stash:

camber stash ls -r stash://your-username/

Show all files (including hidden):

camber stash ls -a stash://your-username/path

JSON output format:

camber stash ls --output json stash://your-username/path

Team stash listing:

First, to see what Team Stash directories are available to you enter camber me. Then you can use the Stash CLI to view files under a path:

camber stash ls stash://team-name/path

You can also get the output in JSON format:

camber me --output json

Removing Files and Directories

To remove files or directories from your stash, use the camber stash rm command:

camber stash rm stash://your-username/path

To delete a directory and any files or directories it contains provide the -r flag.

To bypass the confirmation prompt for this action using the -f flag.

When removing a directory, you must use the -r flag. The command will fail if you attempt to remove a directory without the recursive flag.

Examples

Remove a file:

camber stash rm stash://your-username/file.txt

Remove a directory and any files and directories it contains:

camber stash rm -r stash://your-username/demos

Remove a directory without confirmation:

camber stash rm -rf stash://your-username/demos
Removing files and directories is permanent and cannot be undone. Use this command with caution.

Copying Files and Directories

The camber stash cp command allows you to download, upload, or copy files between Stash locations.

camber stash cp source-path destination-path
Flags:
      --recursive, -r bool   Copy directories recursively (required for directories)
      --exclude stringArray  Exclude local paths matching a pattern when recursively uploading a folder to Stash
      --use-gitignore        Apply .gitignore patterns when recursively uploading a local folder to Stash
When copying a directory, you must use the -r or --recursive flag. The command will fail if you attempt to copy a directory without the recursive flag.

Common Use Cases

Copying Files

When copying files, you can either:

  • Copy to a directory (preserves original filename)
  • Copy with a specific name

Copy a file to a directory (preserves original filename):

# Local to private stash
camber stash cp ./local-file.txt stash://your-username/documents/

# Stash to local
camber stash cp stash://your-username/documents/file.txt ./downloaded-files/

# Stash to stash
camber stash cp stash://your-username/demos/README.md stash://your-username/backup/

Copy a file with a specific name:

# Local to private stash
camber stash cp ./local-file.txt stash://your-username/documents/renamed-file.txt

# Stash to local
camber stash cp stash://your-username/documents/file.txt ./renamed-file.txt

# Stash to stash
camber stash cp stash://your-username/demos/README.md stash://your-username/backup/README-backup.md

Copying Directories

When copying directories, the contents of the source directory will be copied to the destination path. Always use the -r flag.

# Local to private stash
camber stash cp -r ./local-directory/ stash://your-username/documents/

# Stash to local
camber stash cp -r stash://your-username/documents/ ./downloaded-docs/

# Stash to stash
camber stash cp -r stash://your-username/demos/10-get-started/ stash://your-username/archive/10-get-started/

Excluding Files from Folder Uploads

When recursively uploading a local folder to Stash, use --exclude to skip generated, sensitive, or dependency files. You can repeat --exclude for multiple patterns.

camber stash cp -r ./project stash://your-username/projects/project \
  --exclude ".git/**" \
  --exclude ".env*" \
  --exclude "node_modules/**" \
  --exclude ".venv/**" \
  --exclude "dist/**" \
  --exclude "build/**"

Use --use-gitignore to also apply patterns from the source folder’s .gitignore file:

camber stash cp -r ./project stash://your-username/projects/project \
  --use-gitignore \
  --exclude ".git/**" \
  --exclude ".env*"

--exclude and --use-gitignore only apply when uploading a local folder recursively to Stash.

Team and Public Stash Operations

In addition to your private stash, you can also access:

  • Team stash: If you are a member of a team, you can access the team’s stash (stash://team-name/)
  • Public stash: Everyone has read-only access to the Camber public stash (stash://public/)
The public stash (stash://public/) is read-only. You can copy from public stash to your private or team stash, but you cannot copy to public stash.

Examples:

# Copy to/from team stash
camber stash cp ./local-file.txt stash://team-name/shared-docs/
camber stash cp stash://team-name/shared-docs/file.txt ./downloaded-files/

# Copy from public stash
camber stash cp stash://public/examples/template.md stash://your-username/projects/

Error Handling

Common errors and their solutions:

  1. Permission Denied: Ensure you have the necessary permissions to access the source and destination paths.
  2. Directory Copy Without -r: Always use the -r flag when copying directories.
  3. Path Not Found: Verify that the source path exists and is correctly specified.

Testing Path Existence

The camber stash test command allows you to check if a path exists and what type it is:

camber stash test stash://your-username/path
Flags:
      --exists, -e bool      Check if the path exists (default: false)
      --file, -f bool        Check if the path is a file (default: false)
      --directory, -d bool   Check if the path is a directory (default: false)
      --output string        Output format: json

Examples

Check if a path exists:

camber stash test -e stash://your-username/file.txt

Check if a path is a file:

camber stash test -f stash://your-username/file.txt

Check if a path is a directory:

camber stash test -d stash://your-username/directory

Get output in JSON format:

camber stash test -e --output json stash://your-username/file.txt

Creating Directories

The camber stash mkdir command creates new directories in your stash:

camber stash mkdir stash://your-username/new-directory
Flags:
      --output string        Output format: json

Examples

Create a new directory:

camber stash mkdir stash://your-username/projects/new-project

Create a directory in a team stash:

camber stash mkdir stash://team-name/shared-projects/new-project

Create a directory with JSON output:

camber stash mkdir --output json stash://your-username/projects/new-project