Skip to content

Instantly share code, notes, and snippets.

@dbiesecke
Forked from manekinekko/open-in-cloud-shell.md
Last active April 3, 2023 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbiesecke/930478b17b96ff2e38efb5f94f9da0f8 to your computer and use it in GitHub Desktop.
Save dbiesecke/930478b17b96ff2e38efb5f94f9da0f8 to your computer and use it in GitHub Desktop.
google gcloud.tips / Booklet : use the Google Cloud Shell to clone and edit a github repository

Booklets

To easy open Github/Bitbucket/Gist direct in Google Cloud Shell, you can save a Booklet like this & click on it

--

    javascript:location.href='https://console.cloud.google.com/cloudshell/open?git_repo='+encodeURIComponent(document.location.href)+'&page=editor&open_in_editor=README.md';

Open a github repository in the Cloud Shell

The Google Cloud Shell gives you a handy and quick Shell access to your Cloud instance. One thing you may not know is that you can use the Cloud Shell to clone and edit a Github project. Let's see how.

The trick here is to just call the following URL: https://console.cloud.google.com/cloudshell/open with the following parameters:

  1. git_repo: this is the URL to your github repository
  2. open_in_editor: this would be the file you want to open in the editor
  3. page=editor: this tells the cloud shell to open the code editor

We could for instance have the following URL: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/manekinekko/actions-on-google-i18n&page=editor&open_in_editor=index.js.

Now, all you have to do is to add this URL to a HTML anchor element <a> href="..."</a>. Here is an example:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment