我开始使用Google计算引擎,并尝试自动执行VM初始化过程。在启动时,VM应该在bitbucket上克隆一个私有git repo并运行应用程序。
因此,如果是公共回购协议,则将如下所示:
git init myapp
cd myapp
git pull https://[email protected]/me/myapp.git
如果我想让我的代码保密,该怎么办?我应该先下载SSH密钥吗?如果是这样,我该怎么做?
我还尝试过将其克隆到云存储库,但还要求提供凭据。这是更好的方法吗?
浏览Google Repository文档后,我发现您可以使用运行Google命令行的Google Cloud SDK中的帮助程序来访问Google Cloud上的项目存储库:
git config credential.helper gcloud.sh
但是,由于SDK已安装在所有GCE实例中,因此:
git init myapp
cd myapp
git config credential.helper gcloud.sh
git pull https://source.developers.google.com/p/<project-id>/r/default
如果要克隆到本地计算机,只需安装SDK
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句