Skip to content

Commit ee376d1

Browse files
authored
feat(deploy): copy local git config to tmp repo (#7702)
1 parent 07b6c20 commit ee376d1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/docusaurus/src/commands/deploy.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ You can also set the deploymentBranch property in docusaurus.config.js .`);
183183
// Save the commit hash that triggers publish-gh-pages before checking
184184
// out to deployment branch.
185185
const currentCommit = shellExecLog('git rev-parse HEAD').stdout.trim();
186+
const currentGitRootDir = shellExecLog(
187+
'git rev-parse --show-toplevel',
188+
).stdout.trim();
186189

187190
const runDeploy = async (outputDirectory: string) => {
188191
const fromPath = outputDirectory;
@@ -213,6 +216,16 @@ You can also set the deploymentBranch property in docusaurus.config.js .`);
213216
logger.error`Copying build assets from path=${fromPath} to path=${toPath} failed.`;
214217
throw err;
215218
}
219+
220+
const gitConfigFromPath = path.join(currentGitRootDir, `.git`, `config`);
221+
const gitConfigToPath = path.join(toPath, `.git`, `config`);
222+
try {
223+
await fs.copy(gitConfigFromPath, gitConfigToPath);
224+
} catch (err) {
225+
logger.error`Copying git config from path=${gitConfigFromPath} to path=${gitConfigToPath} failed.`;
226+
throw err;
227+
}
228+
216229
shellExecLog('git add --all');
217230

218231
const commitMessage =

0 commit comments

Comments
 (0)