Skip to content

Instantly share code, notes, and snippets.

@manekinekko
Last active December 29, 2022 17:19
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save manekinekko/65b4654fb1aac991d8b804803b71d96a to your computer and use it in GitHub Desktop.
Save manekinekko/65b4654fb1aac991d8b804803b71d96a to your computer and use it in GitHub Desktop.
gcloud.tips: use the Google Cloud Shell to clone and edit a github repository

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:

@chientrm
Copy link

How would I do this with private repo?

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