Create private tutorials in Cloud Shell

Cloud Shell supports the creation of private tutorials, enabling you to design tutorials specifically for your audience.

After you've authored tutorials using the Writing tutorials in Cloud Shell guide and followed the best practices detailed in the Tutorial Style guide, you can host your tutorial in a private Git repository to make it available to your users.

Host private tutorials

To make your tutorial private, you need a private Git repository to host it in. You can use any Git repository hosting service you prefer. This guide uses Cloud Source Repositories; private Git repositories hosted on Google Cloud.

To create a Cloud Source Repositories repository to host your private tutorial:

  1. Launch the Cloud Shell terminal. For a standalone Cloud Shell session, use shell.cloud.google.com.
  2. Create a private repository:

    gcloud source repos create REPO_NAME
    
  3. Clone your repository to Cloud Shell:

    gcloud source repos clone REPO_NAME
    
  4. Move your tutorial file to your locally created repository:

    mv PATH/TO/TUTORIAL REPO_NAME/PATH/TO/TUTORIAL
    
  5. Go to your local repository:

    cd REPO_NAME
    
  6. Add the tutorial to commit:

    git add .
    
  7. Commit the files to the repository with a comment describing the history of this action:

    git commit -m "Add private tutorial to Cloud Source Repositories"
    
  8. Using the git push command, add the contents of the local repository to Cloud Source Repositories:

    git push origin master
    
  9. View your repository and its contents in the Google Cloud console:

    Open Cloud Source Repositories

To help your users reach your tutorial, you can use the Cloud Shell's Open in Cloud Shell feature that lets you define how users access your tutorial. For details on how to customize your link, see the Open in Cloud Shell guide.

For a tutorial hosted in a Cloud Source Repositories repository, you'll need to define the cloudshell_git_repo parameter with the URL of your repository.

An example of a link with cloudshell_git_repo defined:

https://ssh.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https://source.developers.google.com/p/project_name/r/repo_name

You can style this link as a button to embed in your documentation for your users to easily find:

[![Open in Cloud Shell](https://gstatic.com/cloudssh/images/open-btn.svg)](https://ssh.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https://source.developers.google.com/p/project_name/r/repo_name)

Customize tutorials with add-on tools

You can further customize your private tutorial experience by providing your users with custom tooling to work with your tutorial.

To do so, you can create a Docker image that functions as a custom Cloud Shell environment with all the additional packages and custom configurations you want made available to your user. For details on how to create a custom container image and update your Open in Cloud Shell link to reference this container image, see the Customizing container image guide.