Cheat sheet for App Engine development in the cloud using Cloud Shell.

Instructions for uploading to app engine

Git configs (first time)

Set the global user email and name:

git config --global user.email "email@example.com"
git config --global user.name "YOUR NAME"

Initialize Git:

git init

Authorize gcloud to access GCP:

git config credential.helper gcloud.sh

Add the repository (make sure the same repository exists in the console):

git remote add google https://source.developers.google.com/p/[project-name]/r/[repository-name]

Syncing cloud repository with local repository

Do a full sync:

git pull google master

“google” is the remote repository defined using git remote add [name] and “master” is the branch.

Uploading code to cloud repository

When you make changes to the files in the code editor, you can create new commits and upload them to the cloud repository.

Add files to local git repository:

git add . -A

Create a commit with a message:

git commit -m "Initial commit"

Push the code to the cloud repository:

git push google master

See pending changes:

For a list of files to be pushed, run:

git diff --stat --cached google/master

For the code diff of the files to be pushed, run:

git diff google/master

To see full file paths of the files that will change, run:

git diff --numstat google/master

Preview the app locally

Make sure you’re in the app folder, and run:

dev_appserver.py app.yaml

Then hit the Web Preview button (top right) to view it!

Change the port number to 8000 in order to see the SDK console.

Deploy to app engine

Make sure app.yaml doesn’t contain the application and version fields. gcloud takes care of those automatically

To deploy the app:

gcloud app deploy app.yaml

Type ‘Y’ to confirm, and it’s live