Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Labs

Migrating Source Code to a Google Cloud Source Repository

Working with code is an everyday reality for cloud application developers, and Google Cloud provides a service that makes it easy to access your code for Google Cloud projects: Source Repositories. This hands-on lab is divided into two parts. In the first part of the lab, you’ll create a new Source Repository and populate it with example code using the `git` command. Once you have pushed the code to the repo, you’ll use the Source Repository interface to inspect the files. In the second part of the lab, you’ll set up another Source Repository to mirror your own existing GitHub repository. Please note it is a prerequisite for this part of the lab to have your own GitHub account and at least one repository.

Lab platform
Lab Info
Level
Beginner
Last updated
Sep 14, 2025
Duration
30m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Enable the Source Repository API.

    Use the API Library to find and enable the Google Cloud Source Repository API.

  2. Challenge

    Create a Source Repository.

    Use the command:

    gcloud source repos create gcpro_repo
    
  3. Challenge

    Clone the Source Repository.

    Use the command:

    gcloud source repos clone gcpro_repo
    
  4. Challenge

    Confirm the cloned repo.

    Use the ls command to view the new cloned repo and then cd into that folder.

  5. Challenge

    Create an example file.

    Use the echo command to create a new file.

  6. Challenge

    Push the new content to the Source Repository repo.
    1. Configure two variables user.email and user.name.
    2. Add the file: git add greetings.txt
    3. Commit the file: git commit -m "Committed initial file" greetings.txt
  7. Challenge

    Push the file from the master branch to origin.

    Use the command:

    git push origin master
    
  8. Challenge

    Confirm the operation.
    1. From the Source Repositories dashboard, click the gcpro_repo repo.
    2. Click the greetings.txt file to review the contents.
  9. Challenge

    Return to the main repository page.

    Click Cloud Source Repositories in the upper-left. Return to the main repository page where you have at least one repository.

  10. Challenge

    Create new repository.
    1. From the Source Repository dashboard, click Add repository.
    2. In the "Add a Repository" dialog, choose Connect external repository.
    3. On the Connect External Repository page, select the current project and then, from the Git Provider list, choose GitHub.
    4. When the Consent checkbox appears, select it.
    5. Choose Connect to GitHub.
    6. From the list of your repos, select one.
    7. Click Connect selected repository.
  11. Challenge

    Confirm the operation.

    When the files of the repo are displayed, select one to open and confirm its contents.

About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight