Google Cloud: How to deploy mirrored Repository

前端 未结 1 404
面向向阳花
面向向阳花 2020-11-30 13:41

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:

  1. Create the app on my

相关标签:
1条回答
  • 2020-11-30 14:04

    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

    1. Switch to the tab with the open shell pane and go to your app’s directory:

      cd helloworldapp
      
    2. 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"
      
    3. Authorize Git to access GCP:

      git config credential.helper gcloud.sh
      
    4. 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 ...
    
    0 讨论(0)
提交回复
热议问题