Skip to content

Commit

Permalink
Add default author to "git commit ..." in the initial commit initiali…
Browse files Browse the repository at this point in the history
…zation step

When run in an environment where git global config has not been set via
```
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
```
and cannot be inferred from local username and hostname, the initialization process fails (git exits with exit code 128). Setting a default
  • Loading branch information
klibardi committed Oct 24, 2024
1 parent b98a53e commit 5fb9188
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/create-remix/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,24 @@ async function gitInitStep(ctx: Context) {
while: async () => {
let options = { cwd: ctx.cwd, stdio: "ignore" } as const;
let commitMsg = "Initial commit from create-remix";
const commitUser = "create-remix";
const commitEmail = "<>"
try {
await execa("git", ["init"], options);
await execa("git", ["add", "."], options);
await execa("git", ["commit", "-m", commitMsg], options);
await execa(
"git",
[
"-c",
`user.name='${commitUser}'`,
"-c",
`user.email='${commitEmail}'`,
"commit",
"-m",
commitMsg
],
options
);
} catch (err) {
error("Oh no!", "Failed to initialize git.");
throw err;
Expand Down

0 comments on commit 5fb9188

Please sign in to comment.