> ## Documentation Index
> Fetch the complete documentation index at: https://docs.squarecloud.app/llms.txt
> Use this file to discover all available pages before exploring further.

# squarecloud.ignore: Exclude Files from Your Deploy

> Use squarecloud.ignore to leave files out of CLI and VS Code deploys: .gitignore syntax, default exclusions like node_modules, pattern rules and examples.

## What is the `squarecloud.ignore` file?

The `squarecloud.ignore` file lists the files and folders to leave out when you upload or commit an application. The Square Cloud CLI (`upload`, `commit` and `zip`) and the Square Cloud VS Code extension read the same file, with the same rules and the same defaults, so a project is packaged the same way by both.

It uses `.gitignore` syntax: comments, wildcards, folder-only and root-only rules, and `!` to bring a file back.

## Creating the file

Create a file named `squarecloud.ignore` in the root of your project.

```gitignore theme={"system"}
# Test output and logs
coverage/
*.log
!keep.log
```

<Info>The file must be named exactly `squarecloud.ignore`. `.gitignore` is not read in its place: it often lists files the application needs to run, such as `.env`.</Info>

## Always left out

These paths are ignored before your own rules, so you don't need to list them:

* `node_modules`
* `.git`, `.github` and `.vscode`
* `package-lock.json`, `pnpm-lock.yaml` and `yarn.lock`

Bring any of them back with a `!` rule.

### Lockfiles

Lockfiles stay out of the zip by default, so Square Cloud installs your dependencies from the version ranges in `package.json`. When you need the exact versions your lockfile pins, bring it back:

```gitignore theme={"system"}
!package-lock.json
```

## Syntax

Each line is a rule. A matching file or folder is left out of the upload.

| Pattern | Matches |
| - | - |
| `file.txt` | A file or folder with this name at any depth. |
| `/config.json` | `config.json` at the project root only. |
| `logs/` | Every folder named `logs` and its contents, but not a file named `logs`. |
| `*.log` | Names ending in `.log`. `*` never crosses a `/`. |
| `?` | Exactly one character, such as `file?.txt`. |
| `[abc]` | One of the listed characters, such as `backup[12].zip`. |
| `**/cache/`, `logs/**`, `a/**/b` | Any number of folders, including none. |
| `!keep.log` | Brings back a file that an earlier rule left out. |
| `# comment` | A comment; it does not exclude anything. |
| `\#notes.txt`, `\!important`, `\*` | A `\` makes the next character literal. |

How the rules are applied:

* **The last matching line wins**, so put `!` rules after the rules they undo.
* **A file inside an ignored folder can't be brought back.** To keep one file of a folder, ignore the folder's contents (`logs/*`) instead of the folder (`logs/`), then add `!logs/keep.log`.
* **Matching ignores case**: `Dist/` also matches `dist`.
* Only trailing spaces are trimmed from a rule, never tabs. Escape a trailing space you want to keep with `\ `.

<Note>Use `/` for folder separators in patterns, including on Windows.</Note>

## Common examples

Exclude development tools and generated files while keeping everything the application needs to run:

```gitignore theme={"system"}
# Tooling
.idea/

# Generated files
coverage/
__pycache__/
*.log

# Temporary files
*.tmp
*.cache
```

<Warning>
  Don't ignore a file your application reads at runtime. If your code loads secrets from a `.env` file and you list `.env` here, the application starts without them and a bot fails with an invalid token. Move those values to the application's [environment variables](/en/platform/environment-variables) first; after that, leaving `.env` out of the upload is safe.
</Warning>

## How it is applied

The CLI and the VS Code extension read `squarecloud.ignore` when preparing the files for upload or commit. Files that match a rule are left out of the zip sent to Square Cloud.

* A symbolic link to a file is uploaded as the file it points to. Links to folders and broken links are skipped.
* The CLI still reads the older names (`.squareignore`, `.squarecloudignore` and `square.ignore`) when `squarecloud.ignore` is missing, and asks you to rename the file.

Keep files required at runtime, such as the `MAIN` file from your [configuration file](/en/getting-started/config-file), outside the ignored paths.

The dashboard upload doesn't read this file: when you build the zip yourself, leave those files out of it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.