- NAME
-
- gcloud topic gcloudignore - reference for
.gcloudignorefiles
- gcloud topic gcloudignore - reference for
- DESCRIPTION
- Several commands in
gcloudinvolve uploading the contents of a directory to Google Cloud to host or build. In many cases, you will not want to upload certain files (i.e., "ignore" them).If there is a file called
.gcloudignorewithin the top-level directory being uploaded, the files that it specifies (see "SYNTAX") will be ignored.Gcloud commands may generate a .gcloudignore file; see the individual command help page for details.
The following
gcloudcommands respect the.gcloudignorefile:-
gcloud app deploy -
gcloud alpha app migrate-to-run -
gcloud beta app migrate-to-run- Note: If you add
app.yamlto the.gcloudignorefile, the above commands will fail.
- Note: If you add
-
gcloud functions deploy -
gcloud builds submit -
gcloud composer environments storage {dags, data, plugins} import -
gcloud container builds submit -
gcloud run deploy -
gcloud run jobs deploy -
gcloud run worker-pools deploy -
gcloud alpha deploy releases create -
gcloud beta deploy releases create -
gcloud deploy releases create -
gcloud infra-manager deployments apply -
gcloud infra-manager previews create -
gcloud alpha functions local deploy -
gcloud alpha run jobs deploy -
gcloud beta run jobs deploy -
gcloud alpha run worker-pools deploy -
gcloud beta run worker-pools deploy
To globally disable
.gcloudignoreparsing (including default file-ignore behavior), run:gcloud config set gcloudignore/enabled falseThe default content of the generated
.gcloudignorefile, which can be overridden with--ignore-file, is as follows:.gcloudignore .git .gitignore
-
- EXAMPLES
- This
.gcloudignorewould prevent the upload of thenode_modules/directory and any files ending in~:/node_modules/ *~
This
.gcloudignore(similar to the one generated when Git files are present) would prevent the upload of the.gcloudignorefile, the.gitdirectory, and any files in ignored in the.gitignorefile:.gcloudignore # If you would like to upload your .git directory, .gitignore file or # files from your .gitignore file, remove the corresponding line below: .git .gitignore #!include:.gitignore
- SYNTAX
- The syntax of
.gcloudignoreborrows heavily from that of.gitignore; see https://git-scm.com/docs/gitignore orman gitignorefor a full reference.Each line in a
.gcloudignoreis one of the following:-
pattern: a pattern specifies file names to ignore (or explicitly include) in the upload. If multiple patterns match the file name, the last matching pattern takes precedence. -
comment: comments begin with#and are ignored (see "ADVANCED TOPICS" for an exception). If you want to include a#at the beginning of a pattern, you must escape it:\#. -
blank line: A blank line is ignored and useful for readability.
Some example patterns follow; see the full reference ( https://git-scm.com/docs/gitignore or
man gitignore) for details.To ignore any file named
foo, and any file in the root of the upload directory namedbar:foo /bar
To ignore any file starting with
foo, ending withbar, or starting withbazand ending withqux:foo* *bar baz*qux
To explicitly include any file named
foo(useful iffoowas excluded earlier in the file) and ignore a file named!bar:!foo \! bar
To ignore any directory
fooand all its contents (though not a filefoo), any filebaz, and the directoryquxand all its contents:foo/ **/baz qux/**
-
- ADVANCED TOPICS
- In order to ignore files specified in the gitignore file, there is a special
comment syntax:
#!include:.gitignoreThis will insert the content of a
.gitignore-style file named.gitignoreat the point of the include line. It does not recurse (that is, the included filecannot#!includeanother file) and cannot be anywhere but the top-level directory to be uploaded.To display files that will be uploaded run:
gcloud meta list-files-for-upload
- NOTES
- These variants are also available:
gcloud alpha topic gcloudignoregcloud beta topic gcloudignore
gcloud topic gcloudignore
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-05-27 UTC.

