从Google Cloud Appengine中的私人github存储库中获取Pip安装包

时间:2019-10-03 01:17:13

标签: python google-app-engine google-cloud-platform pip gcloud

我正在使用Google Cloud Appengine,并使用gcloud app deploy和标准app.yaml文件进行部署。我的requirements.txt文件有一个从github(git+ssh://git@github.com/...git)获取的私有包。此安装可在本地进行,但运行部署时会得到

Host key verification failed.
fatal: Could not read from remote repository.

这表明安装时没有ssh密钥。阅读文档(https://cloud.google.com/appengine/docs/standard/python3/specifying-dependencies)似乎不是一种选择???

Dependencies are installed in a Cloud Build environment that does not provide access to SSH keys. Packages hosted on repositories that require SSH-based authentication must be copied into your project directory and uploaded alongside your project's code using the pip package manager.

在我看来,这似乎不是最佳选择-将代码分解为一个包的整个目的是为了避免重复存储库。现在,如果我想使用Appengine,您是在告诉我这不可能吗?

真的没有解决方法吗?

1 个答案:

答案 0 :(得分:1)

请参阅:

https://cloud.google.com/appengine/docs/standard/python3/specifying-dependencies#private_dependencies

App Engine服务没有(也不应)访问您的私有存储库。

(您不需要的)一种替代方法是将您的公钥上传到App Engine服务。

另一个-如所记录的-您必须在上传过程中向服务提供私人仓库的内容。