I would like both git and gcloud to ignore all package.json files except the one in the base folder. I've set **/package.json in the .gitignore file which works fine except that gcloud also ignores the package.json in the base directory.
I have solved this by creating a .gcloudignore file with the content:
.git
.gitignore
#!include:.gitignore
!package.json
As I want exactly the same behaviour from gcloud and git I would have expected to be able to only set the .gitignore file. Am I doing something wrong?
The reason why
.gcloudignoreis needed to ignore files/directory is that it is the only required file if you want to ignore files when you deploy inside the gcloud environment. Basically these files have similar functions,.gcloudignoreonly works within the gcloud environment.The syntax below should be used inside
.gcloudignoreso that it will exclude all the files or directory inside your.gitignorefile those files/directory:You may check this documentation on
.gcloudignorefor additional information.Hope this helps.