Google Cloud Shell
Google Cloud Shell is an interactive shell environment for Google Cloud Platform.
It makes it easy for you to manage your projects and resources without having to install the Google Cloud SDK and other tools on your system. With Cloud Shell, the Cloud SDK gcloud command-line tool and other utilities you need are always available when you need them.
Google Cloud Shell provides the following:
- A temporary Compute Engine virtual machine instance
- Command-line access to the instance from a web browser
- **Built-in code editor**- 5 GB of persistent disk storage
- Pre-installed Google Cloud SDK and other tools
- Language support for Java, Go, Python, Node.js, PHP, Ruby and .NET
- Web preview functionality
- Built-in authorization for access to GCP Console projects and resources
- Customized environments
Google Cloud Shell Built-in Editor
In this article, we'll be using Google Cloud Shell Built-in Editor to modify source codes on a Google Cloud Source Repository (CSR), if you're not familiar with CSR, check out my article - * Managing Source Codes with Cloud Source Repositories 📁 *
The Built-in Editor is currently in Beta stage and runs Theia, a Cloud & Desktop IDE Platform. It has lots of features as a regular Code Editor.
You can use the code editor to browse file directories as well as view and edit files, with continued access to the Cloud Shell. The code editor is available by default with every Cloud Shell instance.
To easily modify files using the Editor, you can simply Activate Cloud Shell and execute the commands **cloudshell edit FILEPATH **, in my case, I am editing the ~/.bashrc file.
cloudshell edit ~/.bashrc
You'll get a prompt to confirm if you want to Open in Editor, on approval, the Editor would be displayed with the file.
Modifying Sources on Cloud Source Repositories (CSR)
Cloud Shell Editor allows us easily modify files on CSR, to do so, navigate to your Cloud Source Repository, and select a repository of choice. Click on Edit Code at the Top-Right Corner of the page
You can also go ahead to perform git operations and run regular terminal commands on the Shell Terminal.
Customizing the Editor
If you'll like to switch to the Dark theme, on the Menu, Navigate through to ** File > Settings > Change Color Theme ** and Select the Dark Theme
Modifying Sources of a Mirrored Repository
If you're using a Mirrored Cloud Source Repository, you'll probably get an error like this when you try to push code:
A quick fix is to add the remote URL of the repository you're mirroring, in my case, I am mirroring a GitHub repository so I'll run the following commands on my Shell Terminal:
git remote add github https://github.com/Timtech4u/node-cloud-run-cd git push github master
Once that's done, you'll be able to push to your main repository.
Also, Google Cloud Shell is free. 🕺🕺
Thanks for reading through! Let me know if I missed any step, if something didn’t work out quite right for you or if this guide was helpful.