Cloud Source Repositories in Google Cloud: The Complete Intermediate Guide
Understand how Google Cloud's private Git hosting service works, how it connects to builds and deployments, why it is closed to new customers, and how to plan a calm move to a modern alternative.
Imagine a company vault where every team keeps the blueprints of the things it builds. Each blueprint has a complete history: who changed which line, when, and why. If a new design turns out to be a mistake, you simply pull out an older version and carry on. That vault is what a Git repository is for software, and Cloud Source Repositories was Google Cloud’s own managed vault for those blueprints.
This guide explains the service in plain language: what it does, how its parts fit together, how people and machines log in to it, how it connects to other Google Cloud tools, and what it costs. It also covers something every reader needs to know today. Google has stopped offering the service to new customers, and existing customers are expected to move to something else eventually. So this guide is useful in two ways. If you run it already, you will understand it deeply and be able to plan a migration. If you are choosing a tool now, you will understand what it offered and which modern services replace it.
1What Cloud Source Repositories Is and Why It Existed
Start with the problem it solved and the promise it made.
Software is written as text files. Teams need a safe place to store those files, a way for many people to change them without overwriting each other, and a complete history of every change. The tool almost everyone uses for this is Git, a version control system. A repository (often shortened to “repo”) is a project folder that Git tracks, including its entire history.
Cloud Source Repositories, often shortened to CSR, was a fully managed service that hosted private Git repositories inside Google Cloud. “Managed” means Google ran the servers, storage, backups, and availability, so your team did not have to install or maintain a Git server. Because it lived inside Google Cloud, it used the same accounts, permissions, billing, and audit logs as the rest of your cloud projects.
Think of a shared document folder that remembers every edit ever made and lets you rewind to any moment. Git is the memory and rewind feature. Cloud Source Repositories was the secure office building where Google kept that shared folder for you, using the same badge system as the rest of your company’s Google Cloud offices.
The promise
The pitch was straightforward. Keep your code near your cloud resources. Use the same identity system for people and for automated tools. Trigger builds and deployments when code changes. Mirror code from other hosting sites so that cloud tools can read it without extra setup. For teams already invested in Google Cloud, this reduced the number of separate accounts and systems to manage.
Where things stand today
According to Google’s documentation, the service reached end of sale, and since June 17, 2024 it is not available to new customers. Organizations that had never used it cannot enable its API, and new projects that are not attached to an organization cannot enable it either. Organizations that already used it before that date are not affected, so their repositories keep working for now. Google’s migration page also says it is preparing for the service’s deprecation and that a shutdown date, when chosen, will be communicated at least one year ahead of the shutdown.
If you are starting a new project, do not choose this service. You likely cannot enable it, and Google points to Secure Source Manager as its recommended alternative. Read the early chapters to understand the concepts, because they carry over to any Git host, and then jump to the migration chapters.
Why learn a service that is closing?
There are three honest reasons. First, many established organizations still run production pipelines that clone from these repositories, and somebody must understand them to migrate safely. Second, the ideas, such as mirroring, credential helpers, event notifications, and role-based access, appear in every modern code hosting product. Third, understanding what you are leaving behind helps you decide which features you must replace and which you can happily drop.
Who typically used it
The typical customer was a team that already built and ran software on Google Cloud and wanted code hosting close to its builds and deployments. Small teams liked the free tier. Platform teams liked having source access governed by the same permission model as clusters, databases, and networks. Some organizations used it as the quiet, internal home for infrastructure definitions, while keeping public or collaborative projects on other platforms. Understanding this profile helps you judge what your own usage really needs when you pick a successor.
2Core Concepts You Must Know First
Eight ideas explain almost everything else in this guide.
Version Control
A system that records every change to a set of files so you can compare versions, undo mistakes, and see who did what. Git is the most popular one.
Repository
A project folder plus its full change history. In this service, each repository lives inside a Google Cloud project.
Commit
A saved snapshot of changes with a message and an author. Think of it as one entry in the project’s diary.
Branch
A separate line of work. You can try a new idea on a branch without disturbing the stable version, then merge it back.
Clone, Push, Pull
Clone copies a repository to your computer. Push sends your commits up to the server. Pull brings other people’s commits down.
Mirror
A repository that automatically copies another repository. In this service, mirrors pull from GitHub or Bitbucket into a Google-hosted copy.
IAM
Identity and Access Management, Google Cloud’s system that decides who can do what on which resource.
Project
The Google Cloud container that owns resources, billing, and permissions. Every repository belongs to exactly one project.
Git versus a Git hosting service
Git itself is software that runs on your laptop. It does not need a server to function. A hosting service is a shared place where a team’s copies of a repository meet. Without one, people would email patches around or share a network folder. A hosting service adds a central meeting point, permissions, a web browser view, and links to other tools.
Git is like everyone owning a personal notebook with perfect history. The hosting service is the meeting room where everyone brings notebooks, agrees which version is official, and keeps one master copy locked in a cabinet.
Distributed means everyone holds the history
Git is called a distributed system because every clone contains the complete history, not only the latest files. This has a comforting consequence for migration. As long as a trusted person has a full clone, the repository can be rebuilt on a new server. Git’s design is the reason moving between hosting services is practical and not dramatic.
People say “the remote” for the server copy of a repository and “origin” for the default name of that remote. When you move a repository, you are mostly changing where the remote points.
How Git stores history
Git does not save a full copy of every file for every change. Instead, it records snapshots made of small objects, and it reuses any object that did not change. Each snapshot points to its parent, forming a chain from the newest change back to the very first one. Because each link depends on the content before it, changing an old commit changes every commit after it. This is why history is trustworthy: tampering is visible. It is also why “rewriting history” is a serious act that teams avoid on shared branches.
Merging and reviewing
When two people change the same file on different branches, Git tries to combine the changes automatically. If both edited the same lines, it asks a human to decide, which is called a conflict. Many teams add a review step before merging, in which a colleague reads the change, asks questions, and approves. Review catches mistakes, spreads knowledge, and creates a record of decisions. The hosting service you choose determines how pleasant review feels, which is one reason teams compare platforms carefully when replacing an old one.
Tags and releases
A tag is a permanent label on one commit, such as “version-2.4”. Tags let you say exactly which code went into a release. During migration, tags matter as much as branches, because release processes often depend on them. Always verify that the tag count matches after copying.
3Architecture and Components
A high-level look at the parts a request passes through.
Google does not publish a detailed internal blueprint, so this chapter describes the visible, documented building blocks and how they relate. At the top sits your Google Cloud organization, which contains projects. Inside a project, the Cloud Source Repositories API is switched on, and then repositories can be created. People and tools talk to a repository over standard Git protocols, using either secure web connections or SSH.
flowchart TD
ORG["Organization"] --> PRJ["Google Cloud Project"]
PRJ --> API["Cloud Source Repositories API enabled"]
API --> R1["Repository A"]
API --> R2["Repository B"]
DEV["Developer laptop with Git"] -->|"HTTPS or SSH"| R1
CI["Build or deploy tool"] -->|"Service account"| R2
EXT["GitHub or Bitbucket"] -->|"One-way mirror"| R2
R1 --> IAM["IAM permissions"]
R2 --> IAM
R1 --> LOG["Audit logs"]
R2 --> PUB["Pub/Sub notifications"]
Read the diagram from the top. The organization and project provide ownership and billing. The API switch makes the service available in that project. Each repository then connects outward in four directions. People and tools push and pull code. External hosts can feed a mirrored repository. IAM decides who may act. Logs and notifications report what happened.
The components in more detail
| Component | What it does | Everyday example |
|---|---|---|
| Project | Owns repositories, billing, and permissions | A project named “payments-prod” |
| API | Must be enabled before repositories can be created | The switch that turns the service on |
| Repository | Stores code and history | A repo called “checkout-service” |
| Source browser | Web view for files, history, and search | Reading a file in a browser without cloning |
| Mirror | Keeps a copy of an external repository | A GitHub repo copied into Google Cloud |
| Notifications | Publishes repository events to Pub/Sub | A message when someone pushes |
| IAM roles | Control reading, writing, and administering | Reader, Writer, Administrator roles |
Because repositories belong to projects, the project layout of your company shapes your code layout. Teams often create one dedicated project for shared repositories so billing and permissions stay tidy and builds in other projects can reach it with a single, well-understood grant.
Reading the architecture as a migrator
Every arrow in the diagram is a dependency you will have to recreate. The arrows from developers and build tools become new remote addresses and new credentials. The arrow from IAM becomes a new permission model. The arrow from the external mirror source becomes either a new integration or disappears. The arrows to logs and notifications become new audit and event sources. Counting arrows for one repository gives a quick sense of how much work its migration really is.
4Repositories, Projects, and Quotas
How you organize code determines how easy everything else becomes.
One repository, one purpose
A repository should hold something that is built, tested, and released together. A service, a shared library, an infrastructure definition, and a documentation site are common examples. Some companies prefer one huge repository for everything, known as a monorepo. Others prefer many small ones. Both can work, but the choice affects permissions, build times, and how you migrate. Smaller repositories are easier to move one at a time. A huge repository needs more planning, especially around size limits on the destination.
Naming and layout
Choose names that explain purpose, such as “orders-api” or “infra-networking”, not codenames only insiders understand. Keep a short document, in the repository itself, describing what it contains and who owns it. When migration time arrives, a clear ownership record turns a scary inventory exercise into a spreadsheet exercise.
Quotas
Google’s pricing page states that a single project can hold up to 1,000 repositories, and there is no charge for the number of repositories created, subject to quotas. That is generous for most teams. A company that created one repository per customer or per experiment, however, could grow into limits and clutter.
List what exists
Open the Source Repositories page in each project. You need an owner or repository administrator role to see everything.
Classify each repository
Mark it active, archive-only, mirror, or abandoned. Abandoned ones are candidates for deletion.
Record owner and consumers
Write down who owns it and which builds, deployments, or scripts read from it.
Keep the list alive
Update it whenever something changes, so it stays trustworthy during migration.
Google’s own migration page recommends deleting repositories you no longer use. Doing so makes the deprecation process simpler and stops future notifications about them. Before deleting, make sure a full clone exists somewhere safe.
Monorepo versus many repositories
A monorepo keeps many projects in one repository. It makes sharing code and making sweeping changes easy, and everyone sees one history. The cost is size, slower operations, and coarse permissions, since one repository usually means one set of access rules. Many small repositories give crisp ownership and fast operations, but sharing code between them needs extra care, such as versioned libraries. Neither is universally right. What matters for this guide is that size and count both affect migration planning: a monorepo must fit within destination limits, while hundreds of small repositories need automation so that the move is repeatable instead of hand-made.
Which project should own the repository?
Two common layouts exist. In the first, each application project holds its own repositories, which keeps everything about that application together but scatters code across many projects. In the second, a dedicated shared project holds repositories for many teams, which centralizes permissions and billing but needs clear naming and ownership. Whichever you use, write the rule down. During migration, a consistent rule lets you script the inventory instead of discovering exceptions by hand.
Storage hygiene
Repositories grow over time, and history never shrinks on its own. Large binary files, such as compiled programs, videos, and datasets, are a common cause of bloat, because every version stays in history forever. Keep such files in object storage or an artifact registry and store only references in Git. A leaner repository clones faster, costs less, and fits more easily into any destination.
5Authentication and Access Control
Who are you, and what are you allowed to do? Two separate questions with two separate answers.
Authentication proves identity. Authorization decides what that identity may do. Mixing them up is a classic beginner error, so keep them apart in your mind.
At an office building, showing your badge at the door proves who you are. The badge’s access level decides which floors you can enter. Logging in is the first; roles are the second.
How people and tools prove identity
Git talks to the service over two common transports. With secure web connections (HTTPS), the Google Cloud command line can act as a credential helper, a small program that hands Git a short-lived token so you never type a password. With SSH, you register a public key and Git proves possession of the matching private key. Automated systems use service accounts, which are identities for software and not for people. Google’s migration guide notes that HTTPS authentication needs a recent Google Cloud SDK, while SSH works without the SDK.
sequenceDiagram
participant Dev as Developer or Tool
participant Git as Git client
participant Helper as Credential helper
participant Repo as Repository service
participant IAM as IAM
Dev->>Git: git push
Git->>Helper: Need credentials
Helper-->>Git: Short-lived token
Git->>Repo: Push request with token
Repo->>IAM: Is this identity allowed to write?
IAM-->>Repo: Yes or no
Repo-->>Git: Accepted or rejected
The sequence shows why permission errors can look confusing. Authentication can succeed while authorization still fails. If the token is valid but IAM says no, Git reports a denial even though login worked. When troubleshooting, always ask which of the two steps failed.
Roles
Access is granted through IAM roles. The documentation mentions a reader role that allows fetching repository information, and the platform historically offered reader, writer, and administrator levels. Verify the exact names and permissions in current IAM documentation before relying on them, because migration material may refer to different mappings. The principle is what matters: give each person or service account the smallest role that lets them do their job.
| Who | Typical need | Sensible level |
|---|---|---|
| New developer | Read code, propose changes | Read, and write only to their own branches if supported |
| Team developer | Push changes | Write on the team’s repositories |
| Build service account | Read code to build it | Read only |
| Platform lead | Create and delete repositories | Administrator on the shared project |
Granting broad project-level roles to shortcut a permission error gives people access to many repositories at once. Grant on the narrowest resource that works, and review grants regularly.
Credential helpers in daily life
A credential helper is a quiet assistant. Each time Git needs to talk to the server, it asks the helper, which obtains a fresh token using your signed-in cloud identity. Tokens expire quickly, so a stolen token is useful for only a short time. This is safer than storing a password in a file. If a push suddenly fails with an authentication error after months of working, the usual culprits are an expired sign-in, a removed account, or a changed helper configuration on the laptop.
SSH keys
SSH uses a pair of keys: a public one you share and a private one you guard. The server stores the public key and challenges your machine to prove it holds the private one. Protect private keys with a passphrase, never share them, and remove keys from the server when a laptop is lost or a person leaves. Keys that live forever on forgotten laptops are a quiet risk, so review registered keys regularly.
Service accounts for automation
Machines should not borrow human identities. A service account is created for one purpose, such as “builder”, and given only the permissions that purpose needs. Its activity is easy to identify in logs, and it can be disabled without affecting any person. When a migration changes where code lives, remember to grant the same service accounts access in the destination, or builds will fail with permission errors that look mysterious until you recall this step.
Reviewing access regularly
People change teams, contractors leave, and projects end. Without a regular review, access only grows. A quarterly review is enough for most teams: export the list of identities with access, send each repository owner their list, and ask them to confirm or remove entries. Migration is a perfect moment to reset access properly, because you must rebuild it anyway.
Troubleshooting access problems
When someone cannot push, walk through a short checklist. Is the person signed in with the identity they think they are using? Is the credential helper configured on this machine? Does the person hold a role that includes write permission on this specific repository? Is the repository in the project they think it is? Does an organization policy block the action? Answering these in order solves nearly every case without escalation, and writing the checklist into your team guide saves repeated questions.
6Mirroring from GitHub and Bitbucket
Keeping a Google-hosted copy of code that lives elsewhere.
Many teams already keep code on GitHub or Bitbucket but want Google Cloud tools to read it. Mirroring solved this. According to Google’s documentation, the service supports mirroring repositories from GitHub and Bitbucket into a Cloud Source Repositories repository, and commits pushed to the original are copied to the mirror. The direction is one-way: the external site is the source of truth, and the Google copy follows it.
A mirror is like a photocopier that automatically makes a copy of a master document whenever the master changes. You read the copy in a different building, but you edit only the master.
flowchart LR
DEV["Developer"] -->|"push commits"| SRC["GitHub or Bitbucket (source of truth)"]
SRC -->|"automatic one-way copy"| MIR["Mirror in Cloud Source Repositories"]
MIR --> BLD["Cloud tools that read the code"]
DEV -.->|"do not push here"| MIR
The dotted arrow is the rule of thumb: never push to the mirror. Because the copy follows the original, any change made directly to it can be overwritten or can cause the two to disagree. The documentation page on mirroring does not state how fast changes sync or list technical limits, so do not build processes that assume instant propagation.
Why mirroring mattered
- Build and deployment tools in Google Cloud could read code through one familiar permission model.
- Teams could keep a day-to-day workflow on their preferred hosting site.
- A copy inside the company’s own cloud project offered an extra layer of availability and control.
Mirroring and migration
If your repositories are mirrors, migration may be easier than you fear. The original already lives elsewhere, so you may only need to point your tools at the original host, using the modern integration that your build service offers, and then delete the mirror. Always confirm that no one pushed to a mirror by comparing the latest commit with the source.
To see whether a repository is a pure mirror, compare its newest commit hash with the original. If the mirror has commits the original does not, someone wrote to it directly and you must rescue those commits before deleting anything.
Failure modes to expect
Mirrors can fall behind when authorization to the source expires, when the source repository is renamed or deleted, or when the external site has an outage. The symptom is a mirror that quietly stops updating, so builds use stale code without any obvious error. A simple safeguard is a daily check that compares the newest commit on the mirror with the newest commit on the source and alerts when they differ for more than a chosen time.
7Integrations with Other Google Cloud Services
Code hosting rarely stands alone. It feeds builds, deployments, and automation.
Cloud Build
Cloud Build could start automatically when new commits arrived, using triggers tied to a repository and branch. Google’s migration page says to connect Cloud Build to your new source provider, or to use webhook triggers.
Pub/Sub Notifications
Repository events could be published to a Pub/Sub topic, so other systems could react to pushes. This feature was introduced in 2018, according to the release notes.
Config Sync and Infrastructure as Code
Teams stored Kubernetes configuration and infrastructure definitions here. Google suggests Artifact Registry (OCI or Helm), Secure Source Manager, or other source systems as replacements.
Private Connectivity
For private networking needs, Google suggests Developer Connect with Service Directory, or Cloud Build repositories.
Debugging Tools
Older debugging and error tools used repositories for source context. The migration page says to connect another Git provider for those.
Backups
For backing up repositories, Google points to a third-party backup solution.
The event-driven picture
A push to a repository is an event. An event can wake up a build, which produces an artifact, which triggers a deployment. This chain is called a CI/CD pipeline, short for continuous integration and continuous delivery. The repository is the first link. If you replace it, every later link that depends on its events must be re-pointed.
The most painful migration surprises are not repositories but the unlisted things that read them: old triggers, scheduled jobs, deployment scripts with hard-coded addresses, and documentation that tells new hires to clone from the old location. Search for the old repository address everywhere before you switch.
Triggers in practice
A trigger is a rule that says “when this happens in that repository, do this”. A common rule is “when someone pushes to the main branch, run the build and deployment steps”. Another is “when someone opens a change for review, run the tests and report the result”. Triggers hold a reference to a repository and a branch pattern, so when the repository moves, the trigger must be recreated or reconnected. Google’s guidance is to connect the build service to your new source provider or to use webhook triggers, in which the code host sends a web request to start the build.
Notifications and automation
Publishing repository events to a messaging topic enables loosely coupled automation. The repository does not need to know who is listening. One listener might post to a chat room, another might start documentation builds, a third might record an audit trail. This style is flexible, but it creates invisible dependencies: when a topic disappears, listeners go quiet without any error that the repository owner sees. Include topics and subscriptions in your inventory.
Configuration repositories
Some teams store Kubernetes manifests, Helm charts, or infrastructure definitions in repositories so tools can pull and apply them. Google lists Artifact Registry for OCI or Helm packaging as one replacement path, and Secure Source Manager or other systems as another. If your cluster tools pull configuration directly from a repository address, changing that address requires a careful, coordinated update in every cluster, ideally tested in a non-production cluster first.
8Data Flow and the Life of a Change
Follow one small edit from a developer’s keyboard to a running application.
The easiest way to understand a code hosting service is to follow a single change. Suppose a developer fixes a spelling mistake in a checkout page. The change passes through several hands before customers see it.
flowchart TD
A["Developer edits files locally"] --> B["Commit saved on local branch"]
B --> C["Push to repository"]
C --> D["Event published to Pub/Sub or trigger fires"]
D --> E["Build runs: compile and test"]
E --> F{"Tests pass?"}
F -- "Yes" --> G["Package produced and stored"]
F -- "No" --> H["Developer notified and fixes"]
G --> I["Deployment to environment"]
H --> A
Notice the loop: a failed test sends the developer back to editing. Version control is what makes this loop safe. Every attempt is recorded, and nothing is lost if an experiment goes wrong.
Local work
The developer edits files on a branch. Nothing leaves the laptop yet, so mistakes cost nothing.
Push
The commits travel to the hosted repository. Authentication and authorization checks happen here, as shown in the earlier sequence diagram.
Event
The push becomes an event that a trigger or notification listener can act on.
Build and test
An automated build fetches the code at that exact commit, compiles it, and runs tests.
Release
If tests pass, the package is stored and deployed, then watched for problems.
Why exact commits matter
A good pipeline always builds from a specific commit identifier, not “whatever is newest”. That identifier is a unique fingerprint of the exact file contents. If a bug appears in production, you can find which commit was deployed, read exactly what changed, and roll back with confidence.
Record the commit fingerprint inside every built package or in its labels. When an incident happens at three in the morning, nobody should have to guess which version is running.
Branching strategies that fit the flow
Teams usually pick one of two approaches. In trunk-based development, everyone makes small changes that merge into the main branch frequently, supported by automated tests and feature switches. In branch-based flows, longer-lived branches carry features or releases, and merges happen less often but with more ceremony. Trunk-based flows pair well with fast pipelines and reduce merge pain. Longer-lived branches suit products with scheduled releases. Whichever you choose, the repository host must support the protections you rely on, such as required reviews and blocked direct pushes to the main branch. Check this when comparing destinations, because protection features differ between products.
Rollbacks and recovery
Because every change is recorded, undoing one is routine. A revert creates a new commit that cancels an earlier one, leaving history intact and understandable. This is far safer than deleting history. In an incident, the fastest path is usually to redeploy the previous known-good commit while engineers investigate the faulty one calmly.
Speed of feedback
The shorter the time between a push and a build result, the more useful the pipeline. If builds take an hour, developers batch their changes, and failures become harder to diagnose. Keep builds quick by caching dependencies, running tests in parallel, and splitting large repositories. When you migrate, measure build times before and after. A slower pipeline after migration is a hidden cost worth catching early.
9Security Considerations
Source code is among a company’s most valuable and most sensitive assets.
Code contains business logic, internal addresses, and sometimes, by accident, secrets. Protecting repositories therefore matters as much as protecting databases.
Least privilege
Give every person and service account only the access needed. A build account typically needs to read, never to write. A contractor on one project should not see unrelated repositories. Review who has access on a calendar schedule, and remove people who change teams.
Keep secrets out of code
Passwords, API keys, and private keys do not belong in a repository. Even after you delete them in a later commit, they remain in the history and anyone with a clone can find them. The release notes show the service added detection of security keys when pushing changes in 2018, which highlights how common this mistake is. Store secrets in a dedicated secret manager and let applications fetch them at runtime. If a secret does leak into history, treat it as compromised and rotate it, because rewriting history does not undo copies that already exist.
Committing a password is like writing a safe combination on a whiteboard and photographing it every day. Erasing the whiteboard later does not remove the photographs.
Protecting the pipeline
Whoever can change code that a build trusts can effectively run commands in your cloud. Limit who may modify build definitions, require review of changes to deployment files, and make sure builds use identities with narrow permissions. Treat the path from repository to production as a single security chain whose weakest link sets the strength of the whole.
Network and perimeter
Organizations with strict network rules may need private connectivity. Google’s migration page mentions Developer Connect with Service Directory, or Cloud Build repositories, as options for private networking needs in the replacement world. Check whether your organization policies, such as service perimeters, restrict which services your repositories can talk to, so that migration targets are not blocked unexpectedly.
| Risk | Example | Defense |
|---|---|---|
| Leaked secrets | API key committed by accident | Secret manager, scanning, rotation |
| Excess access | Whole company can write to a payments repo | Narrow roles, regular reviews |
| Stolen credentials | SSH private key copied from a laptop | Short-lived tokens, key rotation, disk encryption |
| Malicious change | Altered build file steals data | Code review, limited build permissions |
| Data loss | Repository deleted by mistake | Independent backups, restricted delete rights |
Google’s guidance for backups points to a third-party solution. Do not assume a hosted repository equals a backup. Keep an independent copy, and test that you can restore it.
Protected branches and reviews
The most valuable security control in any code host is a rule that prevents direct changes to the main branch. Changes must come through a reviewed request, and automated checks must pass first. This stops accidents and makes malicious changes harder, since a second person must approve. When you choose a replacement, confirm it supports required reviews, status checks, and restrictions on who can bypass them. Also remember that Google’s migration guide asks you to confirm the destination has no active branch protection during the initial push, then re-enable the rules afterward.
Scanning for problems
Beyond secrets, repositories can contain vulnerable dependencies, unsafe configuration, or outdated libraries. Automated scanners can check each change and report issues before release. Choose scanners that run inside the pipeline so issues block the merge instead of becoming a quarterly clean-up chore. These tools usually integrate through the build step, so they move with the pipeline rather than the repository itself.
Handling a leaked secret
If a secret is committed, act in this order. First, revoke or rotate the secret so it no longer works. Second, check logs for any use of it. Third, remove it from the current files and, if policy requires, from history. Fourth, add a check that prevents the same mistake. The order matters: rotating comes first because history rewriting cannot recall copies that already exist on other machines.
Compliance and evidence
Auditors often ask who can change production code, how changes are approved, and how long records are kept. A hosted repository with enforced reviews, narrow permissions, and retained logs answers these questions with evidence, not promises. Keep exports of access lists and review settings at each migration step, so you can show that controls were maintained throughout the transition and not only before and after it.
10Monitoring, Logging, and Usage Tracking
Know who is using the service, how much, and whether anything unusual is happening.
Google Cloud records administrative actions through Cloud Audit Logs, which answer “who did what, where, and when”. For a repository, audit trails help you investigate access changes and see which identities are active. Exact log categories and fields for this service should be confirmed in current audit logging documentation, because they may differ from what general descriptions suggest.
What to watch
Who has access
Periodically list identities with write or administrator rights and compare against the team roster.
Unusual activity
Large downloads, access from unusual identities, or sudden permission changes deserve a look.
Storage and users
Billing is tied to project-users and storage, so tracking them prevents cost surprises.
Pipeline health
Failed triggers or silent builds can mean a broken connection to the repository.
Using notifications as a monitoring tool
Because repository events can flow to Pub/Sub, a small listener can record every push, flag changes to sensitive branches, or alert on unexpected activity at odd hours. This turns the repository from a silent store into something that reports on itself.
Capture a usage snapshot now: list users, repositories, sizes, and recent activity. It tells you what really matters, what is dead, and how to prioritize the move.
Building a simple dashboard
Even a spreadsheet can serve as a dashboard. Columns might include repository name, owner, last activity date, size, number of users with write access, and migration status. Sort by last activity to find dead repositories, and by size to find those needing special handling. The act of building it forces conversations that would otherwise never happen, such as who actually owns that mysterious repository named “test2”.
11Pricing and Cost Thinking
The model was simple and generous for small teams.
Per Google’s pricing page, billing depended on three things: how many unique people used the repositories, how much data was stored, and how much data left the service. A project-user is a unique user who reads from or modifies a repository in one project.
| Resource | Free each month | Beyond free |
|---|---|---|
| Repositories | No charge for the number created (subject to quotas) | Not applicable |
| Project-users | Up to 5 per billing account | $1 per project-user per month, not prorated |
| Storage | Up to 50 GB | $0.10 per GB per month, prorated |
| Outbound data transfer | Up to 50 GB | $0.10 per GB per month, prorated |
A worked example
Imagine twelve developers who each touch repositories in one project, with 20 GB stored. Seven of them are above the free five, so the user portion is seven dollars per month. Storage is within the free allowance. The total is tiny. The service was cheap, which is part of why teams hesitate to migrate. The important point is that replacement tools may cost much more, so compare total value, not the old invoice. Pricing can change, so confirm it on the pricing page before budgeting.
Include the one-time labor of migration, training, and rebuilding triggers in your budget. The tool bill is rarely the largest part of the move.
Comparing total cost, not only price
When comparing destinations, include per-user charges, storage and transfer, build minutes, security scanning, support plans, and administration time. A tool that looks expensive per user may save hours of engineering time. A tool that looks free may require a team member to maintain servers. Place everything on a three-year view and ask which option leaves the organization with the fewest unpleasant surprises.
12Lifecycle Status: End of Sale and Deprecation
What Google has said, and what remains unknown.
May 15, 2024: announcement
Google announced the service would reach end of sale on June 17, 2024. Customers who had already enabled the API could keep using it.
June 17, 2024: closed to new customers
Organizations that had not used the service before this date can no longer enable it. New projects without an organization cannot enable it either.
Today: preparing for deprecation
The migration page says Google is preparing for deprecation and lists replacement paths by use case.
Future: shutdown date to be announced
No shutdown date is published in the pages reviewed. Google states a date will be communicated at least one year before shutdown, and all repositories must be migrated before it.
Reading between the lines
“Not published yet” does not mean “safe forever”. It means you have time to plan, and Google has promised at least a year of notice after that. Smart teams use this quiet period to inventory, clean, and pilot migrations on low-risk repositories, so that when the date is announced they are already prepared.
Make sure Google Cloud notifications reach a monitored mailbox, not a former employee’s address. Missing a deprecation notice is a preventable and embarrassing failure.
Building your own timeline
Because the shutdown date is unknown, create an internal timeline with soft deadlines. A reasonable plan has four milestones. First, within the next month, finish the inventory and freeze new use. Second, within the next quarter, complete the pilot migration and choose the destination. Third, within the following two quarters, migrate the bulk of repositories in waves. Fourth, finish the long tail and decommission. Each milestone has an owner and a visible status. If Google announces a date, you simply compare it to your schedule and adjust.
Communicating with stakeholders
Non-technical leaders care about risk, cost, and disruption. Explain it plainly: the service is closing to newcomers, a shutdown date will be announced with a year of notice, migration is a known and well-understood task, and starting early keeps costs low and avoids a rush. Share the inventory, the plan, and the expected effort. People support projects they understand, and surprises damage trust far more than honest estimates do.
What happens if you wait
Waiting is not irrational. It buys time and avoids work that may later prove unnecessary. The risk is that the work does not shrink with time; it tends to grow as more pipelines and people depend on the old location. A team that waits should at least complete the inexpensive tasks now: inventory, cleanup, backups, and a freeze on new dependencies.
13Choosing a Replacement
Google’s recommendation is one option among several good ones.
Google recommends Secure Source Manager, described on its pricing page as a regionally deployed, single-tenant, managed Git repository that integrates with Cloud Build, Cloud Deploy, and Artifact Registry. The migration page also names third-party source code management systems for software development. Which is best depends on your priorities.
| Option | Strength | Consideration | Good fit when |
|---|---|---|---|
| Secure Source Manager | Managed inside Google Cloud, close integration with Google build and deploy tools | Newer product with instance-level limits (default 100 GB per instance, per the migration guide) | You want to stay within Google Cloud with minimal change |
| GitHub | Huge ecosystem, familiar to developers, strong review features | Separate vendor, separate identity and billing | Your team already uses it or wants maximum community tooling |
| GitLab | Built-in pipelines and planning tools, self-hosting option | Heavier to operate if self-hosted | You want an all-in-one platform or need self-hosting |
| Bitbucket | Strong with other Atlassian tools | Best when you already use those tools | Your planning tools are Atlassian-based |
Deciding questions
- Where do your people already work and review code every day?
- Do your builds need private network access to the repository?
- Do compliance rules require data to stay in a certain region or on single-tenant infrastructure?
- How large are your biggest repositories compared with destination limits?
- Which integrations, such as chat, tickets, and security scanning, must keep working?
Use-case mapping from Google’s guidance
Software development
Secure Source Manager or a third-party source code management system.
Build triggers
Connect Cloud Build to the new source provider, or use webhook triggers.
Kubernetes and infrastructure config
Artifact Registry (OCI or Helm), Secure Source Manager, or other source systems.
Private networking
Developer Connect with Service Directory, or Cloud Build repositories.
Choosing a new code host is like choosing a new office building. Cost matters, but so do commute time, neighbors, security, and whether your existing furniture fits through the door.
Running a short evaluation
Pick two candidates and run a two-week trial with one real team. Ask them to clone, branch, review, merge, build, and deploy exactly as they would in daily work. Record friction points in a shared list and score each tool against your deciding questions. Real usage reveals things no feature checklist can, such as clumsy review screens or slow clones from a distant region. Make the decision with the team, not for the team, to avoid resistance later.
14Migrating Step by Step
Because Git is distributed, moving a repository is mostly a copy with careful checks.
Google’s guide for moving to Secure Source Manager follows a mirror-copy approach. It is a one-time transfer, not a continuing sync, so anything committed to the old repository after the copy will not appear in the new one. That is why freezing writes first is crucial.
flowchart TD
S1["1. Inventory repositories and consumers"] --> S2["2. Freeze old repo: read-only"]
S2 --> S3["3. Create empty destination repo"]
S3 --> S4["4. Check size against destination limits"]
S4 --> S5["5. Mirror-clone old repo"]
S5 --> S6["6. Push mirror to destination"]
S6 --> S7["7. Validate branches, tags, commits"]
S7 --> S8["8. Re-point builds, scripts, docs"]
S8 --> S9["9. Monitor, then delete old repo"]
What each step really means
Check prerequisites
You need read permission on the source, access to the destination, Git installed, and enough local disk for a temporary clone. HTTPS access needs a Google Cloud SDK version 395.0.0 or later; otherwise use SSH keys on both sides. Private destination instances may need private connectivity.
Make the source read-only
Limit access to a reader role or pause commits so nothing changes during the copy.
Prepare an empty destination
Create the new repository without a starter README, license, or ignore file, confirm it is empty, and confirm no branch protection rules are active, since those can block the push.
Check size
Describe the old repository to see its size. The guide notes a default limit of 100 GB per instance on the destination, so large repositories need planning.
Copy everything
Make a mirror clone of the old repository, add the new one as a second remote, and push everything, including all branches and tags. A mirror clone has no working files, which is normal.
Validate
Clone the new repository into a fresh folder and compare branch count, tag count, the newest commit fingerprint, and total commit count against the old one.
Clean up
Reset any impersonated credentials, re-enable branch protection, delete the local bare copies, and finally delete the original once everything depends on the new home.
Permissions need their own plan
Permissions do not travel with the code. Google publishes a separate guide to translate roles and permissions into the new system, and its migration page lists a few mappings, such as the reader role’s fetch permission mapping to the new service’s access and writer roles. Build a table of who had which access, decide the equivalent in the destination, and apply it deliberately. Test with a normal developer account, not just an administrator.
Migrate one small, low-risk repository first. Write down every surprise. Your second and third migrations will be dramatically smoother, and your runbook will be based on experience, not assumption.
The documented process does not keep the two repositories in sync. If anyone commits to the old repository after you copy it, those commits will be lost unless you repeat the copy. Announce a clear cutover time and enforce it.
Automating many migrations
For dozens or hundreds of repositories, hand-made migration invites mistakes. A simple automation pattern reads the inventory, performs the same sequence for each repository, and writes a result line for each: source name, destination name, branch count, tag count, newest commit fingerprint, and pass or fail. Humans review the failures only. Run the automation first against a test destination so errors are cheap. Keep the logs, because they become your evidence that nothing was lost.
Cutover day
Pick a quiet time and announce it widely. Freeze the old repository, run the migration, validate, update triggers, and ask one or two developers to confirm that cloning, committing, and pushing work from their own machines. Keep the old repository read-only, not deleted, for a few weeks as a safety net. Only after that period of calm, and after the independent archive exists, delete it.
Helping developers switch
Developers experience migration as a changed address. Give them a one-page guide: the new address, how to sign in, the single command to change the remote address on an existing clone, and where to ask for help. Post it where they will see it and repeat it in team meetings. A good guide prevents a flood of small questions on cutover day.
After the move
Measure whether the new setup is better. Look at build times, review turnaround, permission requests, and developer satisfaction. Remove leftover mirrors and triggers. Update diagrams and onboarding material. Then hold a short retrospective and record lessons, so the next platform change, which will eventually come, is easier than this one.
Rollback plan
Every migration needs a way back. Because the old repository stays read-only and intact until the new one is proven, rolling back is simple: restore write access to the old repository and re-point triggers to it. Write these two or three steps down before cutover, and decide in advance what conditions would cause you to use them, such as widespread build failures that cannot be fixed within a set time. A plan you never use is cheap insurance.
15Advantages, Disadvantages, and Trade-offs
An honest look at what the service did well and where it fell short.
Advantages
- Private Git hosting using the same identities, permissions, and audit logs as the rest of Google Cloud.
- Nothing to install, patch, or scale, because the service was fully managed.
- Generous free tier and low prices for small teams.
- Mirroring from GitHub and Bitbucket let Google tools read code hosted elsewhere.
- Event notifications and build triggers made automation straightforward.
- Standard Git, so moving away is practical.
Disadvantages / Trade-offs
- Closed to new customers since June 17, 2024, with deprecation being prepared.
- Lighter collaboration features than the leading code hosting platforms, so many teams paired it with other tools.
- No published shutdown date, which makes planning uncertain.
- Mirroring was one-way only.
- Backups, private networking, and some integrations needed other products.
- Permissions and triggers must be rebuilt in any migration.
The central trade-off
Staying put costs nothing today and avoids disruption, but it accumulates risk, because every new pipeline built on the old service becomes another thing to migrate later. Moving early costs effort now but lets you choose your timing, pilot carefully, and avoid a rushed deadline. Most teams do best by freezing new dependencies on the old service immediately, and migrating gradually.
Stop creating anything new on the old service, even if existing repositories still work. Every new repository, trigger, or script is future migration work.
Weighing the choice for your team
If your team is small, uses a handful of repositories, and builds only inside Google Cloud, the migration is modest and the main question is which destination feels best. If your team is large, has many pipelines and strict compliance rules, the migration is a project that deserves a sponsor, a plan, and a budget. Both situations share one truth: the earlier you start, the more choices you keep.
16Design Patterns and Common Use Cases
Patterns teams used successfully, and which ones transfer to a new host.
Central Code Home for a Cloud Project
A team keeps application code, deployment definitions, and documentation in repositories inside its own project. Builds in the same project read them with a service account. Everything is in one billing and permission boundary.
Mirror for Cloud Tools
Developers work on GitHub or Bitbucket. A mirror gives Google Cloud tools a local copy to build from, so the cloud side never needs the external site’s credentials directly.
Infrastructure as Code Repository
Network, identity, and cluster definitions live in a repository protected by tighter permissions and mandatory review. Changes trigger plans that humans approve before anything is applied.
Event-Driven Automation
Push events flow to Pub/Sub, where small functions react: posting a message to a team channel, starting a documentation build, or tagging a release.
Split Environments
Production deployment definitions live in a separate, more restricted repository than development code. Few people can write to production definitions, and every change is reviewed.
flowchart LR
APP["Application repo"] --> BUILD["Build and test"]
BUILD --> ART["Artifact storage"]
CFG["Deployment config repo (restricted)"] --> DEPLOY["Deployment"]
ART --> DEPLOY
DEPLOY --> ENV["Running environment"]
This pattern keeps the people who write features separate from the people who can change production settings. The artifact comes from the application repository, while the configuration repository decides where and how it runs. Every one of these patterns is host-independent, so they survive migration intact.
Pattern: protect the main branch
Whatever host you use, require reviews and passing checks before changes reach the main branch. This pattern prevents most accidental breakages and raises the bar for malicious changes. It is cheap to adopt and pays off immediately.
Pattern: ownership files
Keep a small file in each repository listing owners and contacts. Review tools can use it to request approval from the right people automatically. It also turns inventory work into a simple search. When a repository is moved, the ownership file moves with it.
Pattern: infrastructure and application separation
Keep the code that builds an application separate from the settings that decide where and how it runs. Different people with different permissions then control each part. This is the idea behind the earlier diagram, and it makes audits easier because deployment changes appear in one place.
17Anti-Patterns to Avoid
Mistakes that make both daily work and migration harder.
Problem
A team starts brand-new work on the service because “it already works for us”.
Why It’s Harmful
The service is being deprecated. New work deepens dependence on something that will need replacing, and creates more migration effort later.
Correct Approach
Create new repositories on the chosen replacement and leave only existing ones behind until they are migrated.
Problem
Treating the hosted repository as the only copy of the code.
Why It’s Harmful
An accidental deletion, a bad permission change, or a service retirement could destroy the history with no recovery path.
Correct Approach
Keep independent backups, such as regular mirror clones stored elsewhere, and practice restoring from them.
Problem
Pushing commits directly to a mirrored repository.
Why It’s Harmful
Mirroring is one-way. Local changes can be overwritten or can cause the copy to diverge from the source, so work disappears or confuses everyone.
Correct Approach
Treat mirrors as read-only copies, and make all changes at the original source.
Problem
Granting broad project-wide roles to avoid permission errors.
Why It’s Harmful
One compromised account can then read or change many repositories, and migration becomes harder because nobody knows who truly needs what.
Correct Approach
Grant the smallest role on the narrowest scope, document the reason, and review regularly.
Problem
Hard-coding the repository address in scripts, build files, and documentation across many places.
Why It’s Harmful
When the address changes, hidden copies break in surprising places, often at the worst time.
Correct Approach
Keep addresses in one configuration location where possible, and search all systems for old addresses when migrating.
Problem
Ignoring deprecation notices because “nothing has been shut down yet”.
Why It’s Harmful
When a shutdown date is finally announced, the team has little experience, no inventory, and a deadline measured in months.
Correct Approach
Use the quiet period to inventory, clean up, pilot, and prepare a runbook.
Warning signs you are drifting into trouble
Watch for these signals: nobody can say how many repositories exist, builds depend on credentials owned by people who left, documentation tells people to clone from addresses that no longer work, or deprecation emails go to an unmonitored mailbox. Each is a small crack that widens under pressure. Fixing them early is cheap and makes any later migration safer.
18Best Practices and Common Mistakes
Habits that serve you whether you stay or move.
Keep a living inventory
Track each repository’s owner, purpose, size, consumers, and mirror status in one shared list.
Delete what you do not use
After keeping an archive copy, remove abandoned repositories to reduce work and notifications.
Use service accounts for machines
Automated tools get their own identities with read-only access, never a person’s credentials.
Build from commit fingerprints
Always know exactly which version of the code a deployed package came from.
Back up independently
Schedule mirror clones to a separate system and test restores.
Document the way in
Each repository describes how to clone, build, test, and who to ask for help.
Rehearse migration
Pilot with a low-risk repository and capture lessons before touching critical ones.
Mistakes seen repeatedly
Forgetting writes in flight
Someone commits to the old repository after the copy, and those commits are lost.
Non-empty destination
Initializing the new repository with a starter file blocks the clean mirror push.
Skipping validation
Without comparing branch counts, tags, and commit totals, missing history goes unnoticed.
Forgetting triggers
Builds quietly stop running because they still point at the old location.
Ignoring size limits
Very large repositories exceed destination limits, so clean up large binary files beforehand.
Admin-only testing
Everything works for the administrator, then ordinary developers discover missing permissions.
Before declaring done: old repository is read-only, new one validated, builds pass from the new location, developers can clone and push, documentation updated, and notifications confirmed to reach a monitored inbox.
A realistic effort estimate
Teams often underestimate migration because the copy itself is fast. The slow parts are discovery and people. A small repository can be copied in minutes. Discovering every consumer, updating every trigger, reconfiguring permissions, retraining people, and waiting for confirmations takes days or weeks. As a rough guide, budget most of your time for discovery, permissions, and communication, and a small portion for the technical copy. Use the pilot to calibrate your own numbers rather than trusting generic estimates.
Measuring success
Define success before you begin. Good measures include: percentage of repositories migrated, number of builds passing from the new location, number of remaining references to the old address, time developers need to get set up, and the number of support requests after cutover. Review them weekly during the project. Visible progress keeps motivation high and exposes stalled work early.
Teaching the team
Short sessions work best. Run a thirty-minute walkthrough showing how to clone, branch, commit, push, and open a review in the new system, followed by an open question period. Record it for newcomers. Pair experienced users with hesitant ones during the first week. Confidence spreads through people, and a relaxed, supported cutover is remembered far more kindly than a rushed one.
19Real-World Scenarios
Short stories that show the ideas at work.
The Startup With Twelve Repositories
A small company discovers its repositories sit on the old service. They list them in an afternoon, clone each with the mirror option, create matching repositories in the new host, and re-point two build triggers. The whole move takes a week, mostly spent on permissions and updating documentation.
The Enterprise With Hundreds of Repositories
A large organization finds that many repositories are abandoned experiments. After owners confirm, a third are archived and deleted. The remainder are migrated in waves by team, with a pilot team going first and a script handling validation checks. A central spreadsheet tracks status.
The Mirror That Was Not Only a Mirror
While planning deletion of a mirrored repository, an engineer compares it with GitHub and finds two commits that exist only in the mirror. A developer had pushed there by mistake months earlier. The commits are rescued and applied properly before deletion.
The Silent Build
A week after cutover, a nightly report stops arriving. The cause is an old scheduled job that still cloned from the previous address. The team adds a search for old addresses to every future migration checklist.
Lessons that repeat
Across these stories the same lessons appear. Inventory first, because surprises live in what you did not list. Validate with numbers, not impressions. Keep the old repository read-only for a while as a safety net. Communicate in advance and often. And treat the people side as seriously as the technical side, since a perfect copy of the code is useless if developers do not know where to find it.
20Frequently Asked Questions
Short answers to the questions people ask most.
Only if your organization used the service before June 17, 2024. Organizations that never used it cannot enable the API, and new projects without an organization cannot enable it.
No shutdown date appears in the documentation reviewed. Google states that a date will be communicated at least one year before shutdown, and all repositories must be migrated before then.
Secure Source Manager for software development, or a third-party source code management system. Other use cases such as build triggers, configuration storage, and private networking have their own recommended paths.
Not if you use a mirror clone and mirror push, which copy all branches, tags, and commits. Validate afterward by comparing counts and the newest commit fingerprint.
No. You must map roles and apply them in the destination. Google provides a separate guide for translating roles and permissions.
No. Documentation describes one-way copying from GitHub or Bitbucket into the Google-hosted repository.
No. The documented process is a one-time transfer. Changes made to the old repository afterward will not appear in the new one.
Per the pricing page, the free tier covered five project-users, 50 GB of storage, and 50 GB of outbound transfer each month. Beyond that, extra users cost one dollar each, and storage and transfer cost ten cents per GB. Confirm current prices before relying on them.
Check its size before migrating. The migration guide mentions a default limit of 100 GB per destination instance. Consider removing large binary files from history or storing them elsewhere.
Not until the new location is validated and everything depends on it. Google advises deleting unused repositories, but keep an archive copy first.
Connect Cloud Build to your new source provider, or use webhook triggers, and then test each trigger with a harmless commit.
Absolutely. Git, branching, review habits, least privilege, and pipeline thinking apply to every hosting platform.
Yes, if your organization used it before the cutoff date. Existing repositories continue to work for now, but avoid adding new dependencies while you plan the move.
No. The documented steps use a handful of basic commands, and the hardest parts are organizational: finding consumers, rebuilding permissions, and communicating clearly.
21Summary and Key Takeaways
Cloud Source Repositories was Google Cloud’s managed private Git hosting, tightly woven into IAM, audit logs, builds, and event notifications, and cheap for small teams. It is now closed to new customers and being prepared for deprecation, with a shutdown date still to be announced and at least a year of promised notice. The wise response is calm preparation: stop adding new dependencies, inventory what you have, choose a destination, rehearse a migration, and carry the good habits with you.
Key Takeaways
- It is a closed door for newcomers — since June 17, 2024 new customers cannot enable the service, and existing users should plan to leave.
- No shutdown date yet, but a one-year notice is promised — use the quiet time to inventory, clean up, and pilot.
- Understand the building blocks — projects own repositories, IAM controls access, and mirrors copy one way from GitHub or Bitbucket.
- Authentication and authorization are separate — proving who you are is not the same as being allowed to act.
- Migration is a careful copy — freeze the source, push a mirror to an empty destination, validate counts and fingerprints, then re-point every consumer.
- Permissions, triggers, and hidden scripts are the real work — they do not travel with the code and must be rebuilt and tested.
- Choose the destination by your needs — Secure Source Manager for staying in Google Cloud, or a third-party platform for ecosystem and workflow fit.