Code and repositories / Monorepos
Make a monorepo
Your team works on acme/web, acme/docs and acme/billing together, but each person clones them in their own folder layout. Make one repository, for example acme/platform, with them as its members, so everyone gets the same checkout.
3 min read
A repository with members is a monorepo. In the checkout, each member is in its own folder.
You need the admin role on the monorepo and on each member.
Tip
To make it from a terminal or over REST, see From a terminal.
1. Start a virtual monorepo
Click + in the header, then Create virtual monorepo. On the new repository page, the Virtual monorepo switch does the same. The page explains how a monorepo works.
2. Name it
Pick the owner and the visibility. Type the name, for example platform.
3. Pick the members
- Under Members, search for each repository and pick it, for example
acme/web,acme/docsandacme/billing. - Each member gets a Folder with its own name. To use another name, change the folder, for example
payforacme/billing.
The list shows the repositories of the owner where you are admin. Forks and monorepos are not in it. In a public monorepo, you cannot pick a private repository.
4. Create it
Click Create virtual monorepo.
The server checks every member before it makes the repository. If one member breaks a rule, it makes nothing, and the error names the member. See Rules for members and Rules for folders.
Done
The home page of acme/platform now has a Members card. It lists each folder and its repository, with the command that clones them all:
src monorepo clone acme/platform
Next: clone and sync the monorepo.
From a terminal
Give --member once for each member:
src repo create acme/platform --private --member acme/web --member acme/docs --member acme/billing:pay
--membertakesOWNER/NAME, orOWNER/NAME:FOLDERfor another folder.--publicmakes a public monorepo. Then each member must be public too.--memberdoes not work with--source.
Over REST, POST /api/v1/repos takes the same list in members: [{"member": "acme/billing", "folder": "pay"}]. Over MCP, create_repo takes members too. See the REST API.
If a member was not added
A member can change after the check and before the add, for example when someone deletes it. That is rare. Then the repository and the other members stay, and the answer names each member that failed:
- The web page stays open and lists each failed member, with a link to the Members page.
srcprintsX Could not add acme/docs: <error>and exits with code 1.- The REST answer and the MCP answer list them in
memberErrors.
Fix the cause, then add the member again, as Add and remove members shows.
Reference
Rules for members
- A member has the same owner as the monorepo.
- A fork or a monorepo cannot be a member, and a member cannot get members.
- A repository can be a member of more than one monorepo, but only one time in each.
- A monorepo has at most 50 members.
- A public monorepo can have public members only. See Mix public and private members.
Rules for folders
- A folder is 1 to 100 letters, digits,
.,-or_. It starts with a letter or a digit. - Each member has its own folder. When you make the monorepo with its members, two folders cannot differ only in case, for example
Webandweb. - A folder cannot have the name of a file or folder at the root of the monorepo, for example
README.md. This includes aREADME.md,.gitignoreorLICENSEthat you add to the new repository. - No member can use the folder
repo. A CI job keeps it for its own repository.