Open in Cloud Shell

The Open in Cloud Shell feature allows you to publish a link that automatically clones a Git repository into Cloud Shell. It also allows for instructions to be printed to the terminal to help users interact with the content.

The Open in Cloud Shell feature helps developers experiment with code samples and APIs without having to worry about downloading Cloud SDK, installing required dependencies, or searching for relevant source files. This page explains how to add this feature to your Git repository.

Currently, only GitHub and BitBucket repositories are whitelisted. If you would like to add a different repository, send feedback with the repository type you'd like to use with Open in Cloud Shell.

URL parameters

The Open in Cloud Shell link, optionally embedded in a button image, can be added to the README.md of any directory in your Git repository. The recommended location for this link is the root README.md of your Git repository.

To add functionality to this Open in Cloud Shell interaction, you can use the following URL parameters:

URL Parameter Description Supported Values
git_repo

URL of the Git repository to clone.

The specified repository will be cloned and the root of the project folder will be opened, displaying its contents in the left hand navigation pane.

Valid URL for a Git repository.

This consists of a whitelisted domain (GitHub or Bitbucket) and a path composed with these valid characters [a-zA-Z0-9_-./].

page

(optional)

Landing page within Cloud Shell. The default page is editor.

Either editor or shell.

Editor opens a split-pane browser page with both the Cloud Shell terminal and the built-in web editor.

Shell opens a browser page with just the terminal.

working_dir

(optional)

Working directory to land the user in on the command line. Any valid file path. Characters must match this whitelist: [a-zA-Z0-9~_-./:]

open_in_editor

(optional)

File(s) to be opened in the integrated Orion editor. Can be repeated to specify multiple files to open. If multiple are specified, they will be opened in the order provided.

Specified file(s) will opened in the right hand editor tabs, one tab per file, in the opened project.

File paths are relative to the current directory. If the working_dir param is provided, the path to these files will be treated as relative to working_dir.

Any valid file path. Characters must match this whitelist: [a-zA-Z0-9~_-./:]

print

(optional)

File in the Git repository, usually consisting of instructions to be printed to the terminal to guide a user's next steps. The file path is relative to the current directory.

If the working_dir param is provided, the path to this file will be treated as relative to working_dir.

Any valid file path. Characters must match this whitelist: [a-zA-Z0-9~_-./:]

Examples

To provide a link to open a sample Git repository in Cloud Shell, you would need to use Markdown such as the following snippet to embed the link in your repository's README.md:

[![Open in Cloud Shell](http://gstatic.com/cloudssh/images/open-btn.png)](https://console.cloud.google.com/cloudshell/open/git_repo=http://path-to-repo/sample.git)

If you'd rather embed this functionality into a website, the HTML equivalent to the above snippet:

<a href="https://console.cloud.google.com/cloudshell/open/git_repo=http://path-to-repo/sample.git"><img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a>

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud Shell