diff --git a/packages/docusaurus/lib/commands/deploy.js b/packages/docusaurus/lib/commands/deploy.js index bc52f6d585..ade37ab342 100644 --- a/packages/docusaurus/lib/commands/deploy.js +++ b/packages/docusaurus/lib/commands/deploy.js @@ -164,7 +164,9 @@ module.exports = async function deploy(siteDir) { const commitResults = shell.exec( `git commit -m "${commitMessage}" -m "Deploy website version based on ${currentCommit}"`, ); - if (shell.exec(`git push origin ${deploymentBranch}`).code !== 0) { + if ( + shell.exec(`git push --force origin ${deploymentBranch}`).code !== 0 + ) { throw new Error('Error: Git push failed'); } else if (commitResults.code === 0) { // The commit might return a non-zero value when site is up to date.