gcloudignore不允许使用标准通配符白名单 [英] gcloudignore doesn't allow standard wildcard whitelist

查看:67
本文介绍了gcloudignore不允许使用标准通配符白名单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Gcloudignore与gitignore一样,可以将某些文件排除在上载到GCF之外.有时,当您的大型项目中包含大量生成的文件时,排除除少数文件之外的所有文件会很有用.

Gcloudignore works like gitignore in that you can exclude certain files from uploading to GCF. Sometimes when you have really large projects with lots of generated files, it can be useful to exclude all files except a few.

.gcloudignore

.gcloudignore

# Ignore everything
# Or /*
*

# Except the Cloud Function files we want to deploy
!/package.json
!/index.js

以下gcloudignore文件为我们提供了:根目录中不存在预期用于定义函数的文件index.js或function.js.表示index.js被忽略并且不能被阅读.

The following gcloudignore file gives us: File index.js or function.js that is expected to define function doesn't exist in the root directory. meaning index.js is ignored and can not be read.

但是,以下忽略文件语法可以很好地部署:

However the following ignore file syntax works just fine to deploy:

# Ignore everything
/[!.]*
/.?*

# Except the Cloud Function files we want to deploy
!/package.json
!/index.js

我尝试查看gcloud程序代码,但我想知道是否有人知道为什么会这样吗?

I tried peering into the gcloud program code, but I was wondering if anyone knows why this is the case?

推荐答案

我也遇到了这个问题.

我找到了一种解决方法-明确允许当前目录:

I found a workaround -- explicitly allow the current dir:

# Ignore everything by default
*

# Allow files explicitly
!foo.bar
!*.baz

# Explicitly allow current dir. `gcloud deploy` fails without it.
!.

为我工作.不知道为什么.

Works for me. Don't know why.

这篇关于gcloudignore不允许使用标准通配符白名单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆