Google Cloud:如何部署镜像存储库 [英] Google Cloud: How to deploy mirrored Repository
问题描述
我尝试部署节点应用程序,该应用程序位于GitHub的存储库中,并由Google App Engine镜像。
我采用的步骤:
-
在我的本地机器上创建应用程序
Github上的存储库 - 在Google控制台中,我告诉App Engine来镜像这个存储库,它是有效的:如果我转到开发,存储库显示:
- 然后我打开Google提供的远程shell,并尝试运行
gcloud app deploy
,这给出了一个错误,然后我注意到这些文件是不在目录中。所以我通过shell浏览了这台机器的所有文件夹,并且找不到它。
问题:我是什么在这里失踪?谷歌镜像我的回购并不意味着它保存在实例中的某个地方?我需要克隆它到那里吗?
我用这个答案指出的解决方案作为参考: https://stackoverflow.com/a/40693455/4495081 。
在网络缓存文章中,所有操作都在云壳内完成,基本上在您的云壳homedir中存在本地回购。从那里它被保存/上传到云端存储库: b
$ b
将源代码保存在云端源代码库
切换到打开shell窗格的选项卡并转到应用程序的目录:
cd helloworldapp
初始化混帐和你的回购。如果您之前完成了前两个步骤,则不需要:
git config --global user.emailyou @ example.com
git config --global user.nameYour Name
git init
git add。 -A
git commit -m初始提交
授权Git访问GCP:
git config credential.helper gcloud.sh
将存储库作为名为'google'的远程存储库添加到本地Git存储库中,首先将您的Cloud
项目的名称替换为[PROJECT_ID]:git remote add google /web/20161119132814/https://source.developers.google.com/p/[PROJECT_ID]/ r / default
git push google master
在您的情况中,您采取了另一个方向:您创建了您的云源代码库并使用开发者控制台将其链接到了您的github上,但您的云外壳中没有回购homebir。
您需要做的就是将您的云源代码库克隆到您的云壳homedir中,我认为可以完成在云壳中,遵循自定义将克隆您的云存储库到部分中指出的步骤浏览/ repo_namerel =nofollow noreferrer>源代码页面,然后从那里部署。
gcloud init
gcloud来源回购克隆repo_name --project = proj_name
cd repo_name
gcloud app deploy ...
I am trying to deploy a node app, which is in a repository in GitHub, and mirrored by the Google App Engine.
The steps I took:
Create the app on my local machine
Published the Repository on Github
- In the Google Console, I told App Engine to mirror this Repository, which works: If I go to Development, the repository shows up:
- Then I open the remote shell Google is providing, and tried to run
gcloud app deploy
, which gave an error, then I noticed the files are not in the directory. So I browsed through all the folders of this machine via the shell, and I can't find it.
Question: What am I missing here? Does Google mirroring my Repo not imply it is somewhere saved on the instance? Do I need to clone it to there as well?
I'm using as reference the solution pointed to by this answer: https://stackoverflow.com/a/40693455/4495081.
In the web-cached article all the ops are done inside the cloud shell, basically a local repo exists in your cloud shell "homedir". From there it is saved/uploaded to the cloud source repository:
Save your source code in Cloud Source Repositories
Switch to the tab with the open shell pane and go to your app’s directory:
cd helloworldapp
Initialize git and your repo. The first two steps aren't necessary if you've done them before:
git config --global user.email "you@example.com" git config --global user.name "Your Name" git init git add . -A git commit -m "Initial commit"
Authorize Git to access GCP:
git config credential.helper gcloud.sh
Add the repository as a remote named ‘google’ to your local Git repository, first replacing [PROJECT_ID] with the name of your Cloud project:
git remote add google /web/20161119132814/https://source.developers.google.com/p/[PROJECT_ID]/r/default git push google master
In your case you went in the other direction: you created your cloud source repository and linked it to your github one using the Developer Console, but no repo exists in your cloud shell homedir.
All you need to do is to clone your cloud source repository into your cloud shell homedir, which I think can be done in the cloud shell, following the custom steps indicated in the Clone your Cloud Repository to a local Git repository
section of the Source Code page, then deploy from there. Something along these lines:
gcloud init
gcloud source repos clone repo_name --project=proj_name
cd repo_name
gcloud app deploy ...
这篇关于Google Cloud:如何部署镜像存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!