[ Web Proxy ]
URL:
Viewing: https://cloud.google.com/source-repositories/docs/csr-ssm-migration-guide [Back]  [Original]

Migrate to Secure Source Manager  |  Cloud Source Repositories  |  Google Cloud Documentation Skip to main content
Google Cloud Documentation [Google Cloud Documentation]
Send feedback

Migrate to Secure Source Manager Stay organized with collections Save and categorize content based on your preferences.

This guide describes how to migrate a Git repository, including all its information, from Google's Cloud Source Repositories (CSR) to Secure Source Manager (SSM). This migration uses standard Git commands to clone and push repository data.

Prerequisites

Before you begin the migration, make sure you meet the following prerequisites:

Migration Steps

The migration process involves cloning the complete repository from CSR to your local computer and then pushing the clone to the SSM repository.

Determine access principal and method for CSR, SSM repositories

You can connect to CSR using HTTP or SSH transports when you authenticate as a user principal, or through HTTP when you authenticate as a service account. You can connect and authenticate with SSM using HTTP or SSH transports, as a user or service account principal.

You don't need to use the same transport or principal across CSR and SSM. Determine the principal and transport you will use for each platform. For more information on impersonating service accounts, see Service account impersonation.

Ensure CSR Repository is Read-Only

This migration guide doesn't use automatic mirroring or synchronization. Therefore, make sure no one writes to the CSR repository during or after the migration. Update IAM permissions so no user has a role other than roles/source.reader on the repository. Alternatively, coordinate with your users to halt all commits during the migration.

Create Secure Source Manager Repository

You can skip this step if an administrator has already created the repository for you.

To create an empty repository in your SSM instance, follow the guide to create a new repository. Make sure that:

Validate SSM Repository Settings

Verify that the repository is empty by checking the UI or by cloning the repository and running git show-ref. The output is empty if the repository is empty.

Make sure there are no active branch protection rules by checking the UI or by using the API. There should be no rules, or all rules should be disabled to prevent blocking the migration.

Ensure local and remote disk space

Before cloning the CSR repository, find its total size. Run gcloud source repos describe <var>CSR_REPO_NAME</var>. This command shows the total number of bytes in the repository. To assess available disk space on a Linux system, run df . to see the number of bytes available in the current directory.

SSM has a default limit of 100 GB of storage per instance. Verify that the CSR repository will fit before you clone it.

Clone the CSR Repository

Clone the full repository history from CSR to your local computer.

  1. Go to the local directory where you want to temporarily store the repository.
  2. Clone the repository: sh git clone <var>CSR_REPO_URL</var> --mirror

This command creates a bare clone, which is optimized for pushing the entire repository contents to another remote. You'll notice that the directory only contains files like config and HEAD, instead of your repository contents. This is expected; all the repository content has been cloned and is present in the objects directory and others, but there is no working copy.

Add the Secure Source Manager Repository as a New Remote

Run the following command:

git remote add ssm <var>SSM_REPOSITORY_URL</var>

Push the Full Repository to Secure Source Manager

Push all branches, tags, and references from the local clone to the SSM remote:

git push --mirror ssm

Validation

After the push operation is complete, clone the SSM repository into a different directory. Then, compare the CSR and SSM copies of the repository:

Cleanup

What's next

Send feedback

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-08-11 UTC.

Need to tell us more? [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-11 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page