Repository: create-react-app
Issue: Problem where git commit not created error occurs when react-app is created
Labels: needs triage,issue: bug report

### Describe the bug
The yarn create react-app start command was executed and the installation completed successfully, but a Git commit not created error occurred.

The following is an error that occurred during installation.
```
yarn create react-app start
➤ YN0000: ┌ Resolution step
➤ YN0061: │ tar@npm:2.2.2 is deprecated: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
➤ YN0000: └ Completed in 2s 214ms
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed
➤ YN0000: Done with warnings in 2s 547ms


Creating a new React app in D:\react\start.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

➤ YN0000: ┌ Resolution step
➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
➤ YN0061: │ rollup-plugin-terser@npm:7.0.2 is deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
➤ YN0061: │ svgo@npm:1.3.2 is deprecated: This SVGO version is no longer supported. Upgrade to v2.x.x.
➤ YN0061: │ sourcemap-codec@npm:1.4.8 is deprecated: Please use @jridgewell/sourcemap-codec instead
➤ YN0061: │ stable@npm:0.1.8 is deprecated: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
➤ YN0061: │ @npmcli/move-file@npm:2.0.1 is deprecated: This functionality has been moved to @npmcli/fs
➤ YN0061: │ w3c-hr-time@npm:1.0.2 is deprecated: Use your platform's native performance.now() and performance.timeOrigin.
➤ YN0002: │ eslint-config-react-app@npm:7.0.1 [ffe32] doesn't provide @babel/plugin-syntax-flow (pc8ae9), requested by eslint-plugin-flowtype
➤ YN0002: │ eslint-config-react-app@npm:7.0.1 [ffe32] doesn't provide @babel/plugin-transform-react-jsx (pff915), requested by eslint-plugin-flowtype
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 14s 826ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ yallist@npm:4.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yaml@npm:1.10.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs-parser@npm:20.2.9 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs@npm:16.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yocto-queue@npm:0.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 13s 300ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0007: │ core-js@npm:3.27.1 must be built because it never has been before or the last one failed
➤ YN0007: │ core-js-pure@npm:3.27.1 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 24s 324ms
➤ YN0000: Done with warnings in 52s 747ms

Initialized a git repository.

Installing template dependencies using yarnpkg...
➤ YN0000: ┌ Resolution step
➤ YN0002: │ eslint-config-react-app@npm:7.0.1 [ffe32] doesn't provide @babel/plugin-syntax-flow (pc8ae9), requested by eslint-plugin-flowtype
➤ YN0002: │ eslint-config-react-app@npm:7.0.1 [ffe32] doesn't provide @babel/plugin-transform-react-jsx (pff915), requested by eslint-plugin-flowtype
➤ YN0002: │ start@workspace:. doesn't provide @testing-library/dom (pda1af), requested by @testing-library/user-event➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 3s 486ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ min-indent@npm:1.0.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ pretty-format@npm:29.3.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ redent@npm:3.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ strip-indent@npm:3.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ web-vitals@npm:2.1.4 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 1s 590ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0000: └ Completed in 0s 665ms
➤ YN0000: Done with warnings in 6s 48ms
Removing template package using yarnpkg...

➤ YN0000: ┌ Resolution step
➤ YN0002: │ eslint-config-react-app@npm:7.0.1 [ffe32] doesn't provide @babel/plugin-syntax-flow (pc8ae9), requested by eslint-plugin-flowtype
➤ YN0002: │ eslint-config-react-app@npm:7.0.1 [ffe32] doesn't provide @babel/plugin-transform-react-jsx (pff915), requested by eslint-plugin-flowtype
➤ YN0002: │ start@workspace:. doesn't provide @testing-library/dom (pda1af), requested by @testing-library/user-event➤ YN0000: │ Some peer dependencies are incorrectly met; run
 yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 0s 481ms
➤ YN0000: ┌ Fetch step
➤ YN0019: │ cra-template-npm-1.2.0-5ec02f7dcd-50f11eb15f.zip appears to be unused - removing
➤ YN0000: └ Completed in 1s 315ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0000: └ Completed in 0s 450ms
➤ YN0000: Done with warnings in 2s 561ms
Git commit not created Error: Command failed: git add -A
    at checkExecSyncError (node:child_process:861:11)
    at execSync (node:child_process:932:15)
    at tryGitCommit (D:\react\start\.yarn\__virtual__\react-scripts-virtual-ffe325fc0b\0\cache\react-scripts-npm-5.0.1-d06bd2d5ad-92afa2f245.zip\node_modules\react-scripts\scripts\init.js:61:5)
    at module.exports (D:\react\start\.yarn\__virtual__\react-scripts-virtual-ffe325fc0b\0\cache\react-scripts-npm-5.0.1-d06bd2d5ad-92afa2f245.zip\node_modules\react-scripts\scripts\init.js:350:25)
    at [eval]:3:14
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:313:38)
    at node:internal/process/execution:79:19
    at [eval]-wrapper:6:22 {
  status: 128,
  signal: null,
  output: [ null, null, null ],
  pid: 2360,
  stdout: null,
  stderr: null
}
Removing .git directory...

Success! Created start at D:\react\start
Inside that directory, you can run several commands:

  yarn start
    Starts the development server.

  yarn build
    Bundles the app into static files for production.

  yarn test
    Starts the test runner.

  yarn eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd start
  yarn start

Happy hacking!
```

### Did you try recovering your dependencies?
Not Applicable

### Which terms did you search for in User Guide?

git, commit, init

### Environment

```
Environment Info:

  current version of create-react-app: 5.0.1
  running from C:\Users\MSI\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app

  System:
    OS: Windows 10 10.0.19045
    CPU: (6) x64 Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz
  Binaries:
    Node: 16.19.0 - D:\nodejs\node.EXE
    Yarn: 3.3.1 - D:\nodejs\yarn.CMD
    npm: 8.19.3 - D:\nodejs\npm.CMD
  Browsers:
    Chrome: 109.0.5414.74
    Edge: Spartan (44.19041.1266.0), Chromium (109.0.1518.55)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    react: Not Found
    react-dom: Not Found
    react-scripts: Not Found
  npmGlobalPackages:
    create-react-app: Not Found
```

### Steps to reproduce and Expected behavior

1. node.js , git, yarn install
2. In the terminal, two commands were executed: git config --global user.name <username> and git config --global user.email <email>
3. Create a directory where the project will be created
4. Start the terminal and run the yarn create react-app start command in the directory path
5. The project is created and the git repository must be created in that folder. A branch is also created.

### Actual behavior
![git commit not created](https://user-images.githubusercontent.com/49503760/213087741-bec7281c-421f-4201-88f3-1e9871ef4b11.jpg)

### Reproducible demo
No reproducible project exists because it occurred during project creation