{"record":{"id":"419aa7eb2f2e15f3","repo":"facebook/docusaurus","slug":"for-github-pages-organization-deployments-docusa","errorCode":null,"errorMessage":"For GitHub pages organization deployments, 'docusaurus deploy' does not assume anymore that 'master' is your default Git branch.\nPlease provide the branch name to deploy to as an environment variable, for example DEPLOYMENT_BRANCH=main or DEPLOYMENT_BRANCH=master .\nYou can also set the deploymentBranch property in docusaurus.config.js .","messagePattern":"For GitHub pages organization deployments, 'docusaurus deploy' does not assume anymore that 'master' is your default Git branch\\.\nPlease provide the branch name to deploy to as an environment variable, for example DEPLOYMENT_BRANCH=main or DEPLOYMENT_BRANCH=master \\.\nYou can also set the deploymentBranch property in docusaurus\\.config\\.js \\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/docusaurus/src/commands/deploy.ts","lineNumber":178,"sourceCode":"    exec('echo \"Skipping deploy on a pull request.\"', {\n      log: false,\n      failfast: true,\n    });\n    process.exit(0);\n  }\n\n  // github.io indicates organization repos that deploy via default branch. All\n  // others use gh-pages (either case can be configured actually, but we can\n  // make educated guesses). Organization deploys look like:\n  // - Git repo: https://github.com/<organization>/<organization>.github.io\n  // - Site url: https://<organization>.github.io\n  const isGitHubPagesOrganizationDeploy = projectName.includes('.github.io');\n  if (\n    isGitHubPagesOrganizationDeploy &&\n    !process.env.DEPLOYMENT_BRANCH &&\n    !siteConfig.deploymentBranch\n  ) {\n    throw new Error(`For GitHub pages organization deployments, 'docusaurus deploy' does not assume anymore that 'master' is your default Git branch.\nPlease provide the branch name to deploy to as an environment variable, for example DEPLOYMENT_BRANCH=main or DEPLOYMENT_BRANCH=master .\nYou can also set the deploymentBranch property in docusaurus.config.js .`);\n  }\n\n  const deploymentBranch =\n    process.env.DEPLOYMENT_BRANCH ?? siteConfig.deploymentBranch ?? 'gh-pages';\n  logger.info`deploymentBranch: name=${deploymentBranch}`;\n\n  const githubHost =\n    process.env.GITHUB_HOST ?? siteConfig.githubHost ?? 'github.com';\n  const githubPort = process.env.GITHUB_PORT ?? siteConfig.githubPort;\n\n  let deploymentRepoURL: string;\n  if (useSSH) {\n    deploymentRepoURL = buildSshUrl(\n      githubHost,\n      organizationName,\n      projectName,","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus/src/commands/deploy.ts#L160-L196","documentation":"Thrown when deploying a GitHub Pages *organization* site (repo name contains `.github.io`) but no deployment branch has been specified. Docusaurus no longer assumes `master` for org pages; the user must explicitly state where to push. The deploy command checks `DEPLOYMENT_BRANCH` env var and `siteConfig.deploymentBranch`; if both are absent for an org-pages repo, it refuses to guess.","triggerScenarios":"`projectName` resolves to a value containing `.github.io` (e.g. `my-org.github.io`) AND neither `process.env.DEPLOYMENT_BRANCH` nor `siteConfig.deploymentBranch` is set.","commonSituations":"Migrating an org/user `.github.io` site from an older Docusaurus that assumed `master`; first deploy after GitHub renamed the default branch to `main`; new org site that never set `deploymentBranch`.","solutions":["Set `deploymentBranch: 'main'` (or your org-pages default branch) in `docusaurus.config.js`.","Export `DEPLOYMENT_BRANCH=main` (or `master`) in your deploy environment.","Confirm the actual default branch on GitHub (`https://github.com/<org>/<org>.github.io`) and match it.","If this is a project site (not an org site), rename the repo so it does not end in `.github.io` to fall back to the `gh-pages` default."],"exampleFix":"// before\nexport default {\n  organizationName: 'my-org',\n  projectName: 'my-org.github.io',\n};\n// after\nexport default {\n  organizationName: 'my-org',\n  projectName: 'my-org.github.io',\n  deploymentBranch: 'main',\n};","handlingStrategy":"validation","validationCode":"const isOrgPages = projectName.includes('.github.io');\nconst hasBranch = Boolean(process.env.DEPLOYMENT_BRANCH || siteConfig.deploymentBranch);\nif (isOrgPages && !hasBranch) {\n  throw new Error('Set deploymentBranch for an org .github.io site');\n}","typeGuard":"function isOrgPagesDeploy(projectName: string): boolean {\n  return typeof projectName === 'string' && projectName.includes('.github.io');\n}","tryCatchPattern":"try { await deploy(siteDir, cliOptions); }\ncatch (e) {\n  if (/does not assume anymore that 'master'/.test(e.message)) {\n    process.env.DEPLOYMENT_BRANCH = 'main'; // or set in config\n    await deploy(siteDir, cliOptions);\n  } else throw e;\n}","preventionTips":["Always set `deploymentBranch` explicitly in config — never rely on the implicit default.","Check the GitHub default branch before first deploy.","For org sites, default to `main` rather than the legacy `master`."],"tags":["deploy","github-pages","config","env","branch"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}