The Simplest Way to Make GitHub Codespaces and Mercurial Work Like They Should
Using github codespaces and mercurial together lets teams edit legacy code inside cloud containers. Developers spin up a fresh workspace and pull changes from a remote Mercurial server. Many older apps still live in Mercurial repos while new tools use Git. Running a cloud workspace gives every coder the exact same build tools and packages. Teams do not need to spend days setting up local laptops for old codebases. Instead, they launch a container that already has the right Mercurial client inst
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Using github codespaces and mercurial together lets teams edit legacy code inside cloud containers. Developers spin up a fresh workspace and pull changes from a remote Mercurial server.
Many older apps still live in Mercurial repos while new tools use Git. Running a cloud workspace gives every coder the exact same build tools and packages. Teams do not need to spend days setting up local laptops for old codebases. Instead, they launch a container that already has the right Mercurial client installed.
How github codespaces and mercurial share keys and data
GitHub Codespaces runs a virtual machine in the cloud for each developer session. By default, that workspace expects to talk to a Git repo on GitHub. To use Mercurial, the container startup script must install the Mercurial client binary. Next, the workspace pulls the source tree from your external Mercurial host.
This data flow requires a valid login key between the cloud container and Mercurial. Teams often store an SSH key or token in their cloud secret store. When the workspace boots, it reads that secret into the container file system. The Mercurial client then uses that key to pull commits and push new code.
Permissions depend on what that stored key can do on the Mercurial server. If the key belongs to an admin account, the workspace gets full write power. If the key belongs to a read-only user, the coder can only pull changes. Network traffic flows straight from the cloud workspace out to your Mercurial server port.
Common failure modes and how to scope roles
The biggest risk in this setup is sharing one service account across the team. Sometimes an admin creates one master SSH key for the whole group to share. Every cloud workspace then uses that single key to push code to Mercurial. When a bad commit lands, the server logs only show the shared account name. You lose all audit trails of who actually wrote or pushed the change.
Broad tokens create another big problem for security teams. A developer might put a personal key with full admin rights into the workspace. That key sits on the container disk for the whole life of the workspace. If a bad script or package runs inside the container, it can read that key. The attacker could then delete branches or read private code from other repos.
GitHub Actions Security + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Unlogged network paths also make it hard to track activity across systems. Cloud workspaces use dynamic IP addresses that change all the time. Opening your Mercurial server to all cloud IP ranges invites outside attacks. You should scope network paths so only approved workspaces reach the version control host.
To fix these issues, give each developer their own scoped role and personal key. Never bake shared SSH keys into the base container image for your workspaces. Map every Mercurial action back to a single human user in your central logs. Limit each key so it can only touch the single repo needed for work. Rotate keys often and remove them when a cloud workspace shuts down.
Managing container startup for version control
A clean setup starts with a small base image that boots fast. Keep the base Git repo tiny so the cloud workspace starts in seconds. Use that Git repo only to hold the container definition and startup script. Once the machine starts, the startup script can clone the real Mercurial project.
Make sure the container disk cleans up sensitive files when the session ends. Do not leave plain text passwords in shell history files or config folders. Check your server logs every week to spot failed login tries from cloud hosts. Good role scoping keeps both your cloud workspaces and your old code safe.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Can GitHub Codespaces open a Mercurial repository directly?
No, it requires a small Git repo to hold the container setup files first. Once the container starts, a startup script installs Mercurial and clones your actual code.
How should developers log in to the remote Mercurial server?
Each developer should use an individual key stored in their personal cloud user secrets. Avoid putting shared team keys inside the container image or project files.
How do we restrict network traffic to a private Mercurial host?
Do not open your Mercurial server to the public internet for cloud workspaces. Route workspace traffic through a secure network tunnel that checks user identity first.
Related guides
In this post