gcloud alpha topic gcloudignore Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud alpha topic gcloudignore - reference for
.gcloudignorefiles
- gcloud alpha topic gcloudignore - reference for
- DESCRIPTION
(ALPHA)Several commands ingcloudinvolve uploading the contents ofa directory to Google Cloud to host or build. In many cases, you will not wantto upload certain files (i.e., "ignore" them).If there is a file called
.gcloudignorewithin thetop-level directory being uploaded, the files that it specifies(see "SYNTAX") will be ignored.Gcloud commands may generate a .gcloudignore file; see the individual commandhelp page for details.
The following
gcloudcommandsrespect the.gcloudignorefile:gcloud app deploy- Note: If you add
app.yamlto the.gcloudignorefile,this command will fail.
- Note: If you add
gcloud functionsdeploygcloud buildssubmitgcloud composer environments storage {dags, data, plugins} importgcloud container builds submitgcloud run deploygcloud run jobsdeploy- gcloud alpha deploy releases create
gcloudinfra-manager deployments applygcloudinfra-manager previews creategcloud alphafunctions local deploygcloud alpha runjobs deploygcloud beta run jobsdeploygcloud alpharun worker-pools deploygcloud betarun worker-pools deploy
To globally disable
.gcloudignoreparsing (including defaultfile-ignore behavior), run:gcloudconfigsetgcloudignore/enabledfalseThe default content of the generated
.gcloudignorefile, which canbe 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 arepresent) 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; seehttps://git-scm.com/docs/gitignoreorman gitignorefor a full reference.Each line in a
.gcloudignoreis one of the following:pattern: a pattern specifies file names to ignore (or explicitlyinclude) in the upload. If multiple patterns match the file name, the lastmatching pattern takes precedence.comment: comments begin with#and are ignored (see"ADVANCED TOPICS" for an exception). If you want to include a#atthe 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/gitignoreor
man gitignore) for details.To ignore any file named
foo, and any file in the root of theupload directory namedbar:foo/bar
To ignore any file starting with
foo, ending withbar,or starting withbazand ending withqux:foo**barbaz*qux
To explicitly include any file named
foo(useful iffoowas excluded earlier in the file) and ignore a file named!bar:!foo\!barTo ignore any directory
fooand all its contents (though not a filefoo), any filebaz, and the directoryquxand all its contents:foo/**/bazqux/**
- ADVANCED TOPICS
- In order to ignore files specified in the gitignore file, there is a specialcomment 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#!includeanotherfile) and cannot be anywhere but the top-level directory to be uploaded.To display files that will be uploaded run:
gcloudmetalist-files-for-upload
- NOTES
- This command is currently in alpha and might change without notice. If thiscommand fails with API permission errors despite specifying the correct project,you might be trying to access an API with an invitation-only early accessallowlist. These variants are also available:
gcloudtopicgcloudignoregcloudbetatopicgcloudignore
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-22 UTC.