Skip to Content

Open a Github repo in Cloud Shell

To easily get started or share a project

Posted on One min read

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:

  • git_repo — this is the URL to your github repository
  • open_in_editor — this would be the file you want to open in the editor
  • page=editor — this tells the cloud shell to open the code editor

We could, for instance, craft 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 button opening the Github repository above:

More information

To learn more about this “open in Cloud Shell” capability, please read:

One more thing…

And for the record, this “Open in Cloud Shell” feature is also what’s used at the end of the Kubernetes comics, to launch your first Kubernetes cluster on the Google Cloud Platform.

comments powered by Disqus