App Engine 部署:凭据文件不可写。 ...以只读模式打开。 ...任何刷新的凭据仅对此有效 运行

App Engine Deploy: credentials file not writable. ... Opening in read-only mode. ... Any refreshed credentials will only be valid for this run

我最近升级了我的云 SDK,现在我无法再灵活地部署到 App Engine。我使用以下命令部署我的应用程序:

C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\gcloud.cmd preview app deploy --promote vm.yaml

我得到以下输出并崩溃(删节):

WARNING: Could not acquire lock C:\Users\Michael\AppData\Roaming\gcloud\credentials.lock in 0 seconds
WARNING: The credentials file (C:\Users\Michael\AppData\Roaming\gcloud\credentials) is not writable. Opening in read-only mode. Any refreshed credentials will only be valid for this run.
WARNING: Could not acquire lock C:\Users\Michael\AppData\Roaming\gcloud\credentials.lock in 0 seconds
WARNING: The credentials file (C:\Users\Michael\AppData\Roaming\gcloud\credentials) is not writable. Opening in read-only mode. Any refreshed credentials will only be valid for this run.
WARNING: Could not acquire lock C:\Users\Michael\AppData\Roaming\gcloud\credentials.lock in 0 seconds
WARNING: The credentials file (C:\Users\Michael\AppData\Roaming\gcloud\credentials) is not writable. Opening in read-only mode. Any refreshed credentials will only be valid for this run.
...
ERROR: gcloud crashed (OSError): [Errno 13] Permission denied: 'C:\Users\Michael\AppData\Roaming\gcloud\credentials.lock'

If you would like to report this issue, please run the following command:
  gcloud feedback

下面是 gcloud feedback

的一些输出
Trace:
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\gcloud_main.py:171
 gcloud_cli.Execute()
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\calliope\cli.py:719
 result = args.calliope_command.Run(cli=s...
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\calliope\backend.py:1404
 resources = command_instance.Run(args)
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\surface\app\deploy.py:91
 return deploy_util.RunDeploy(self, args,...
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\command_lib\app\deploy_util.py:206
 service, code_bucket_ref)
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\api_lib\app\deploy_app_command_util.py:233
 _UploadFiles(files_to_upload, bucket_ref...
C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\api_lib\app\deploy_app_command_util.py:175
 results = pool.map(_UploadFile, tasks)
c:\Python27\lib\multiprocessing\pool.py:251
 return self.map_async(func, iterable, ch...
c:\Python27\lib\multiprocessing\pool.py:567
 raise self._value
OSError: [Errno 13] Permission denied: 'C:\Users\Michael\AppData\Roaming\gcloud\credentials.lock'


Installation information:

Google Cloud SDK [120.0.0]

Platform: [Windows, x86_64]
Python Version: [2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)]]
Python Location: [c:\Python27\python.exe]
[output truncated]

有什么想法吗?

这是 2016 年 6 月推出的 bug with the Google SDK's 并行上传功能。通过使用以下命令关闭该功能来解决该错误:

gcloud config set app/num_file_upload_processes 1

上面的命令将并行上传的数量限制为 1 thread/process,所以他们不会踩到对方的脚。

我最近遇到了同样的问题。转到错误消息中显示的目录。您会找到两个凭证文件。删除带有 LOCK 扩展名的那个(它将是空的)。然后重新部署你的项目。非常适合我。

我也 运行 关注这个问题。它是如何发生的 --> 我使用 运行 gcloud app deploy 命令,但后来意识到部署需要更长的时间才能完成(可能挂起),然后我终止了批处理过程,即 CTRL + C。当我重新发出命令时,就是我遇到这个问题的时候。所以解决方案,做上面已经说过的,即去删除 credentials.lock 文件(在我的例子中它在 C:\Users\Sam\AppData\Roaming\gcloud 目录中找到)

解决这个错误比较好的方法是删除lock文件所在的根目录后重新安装