"Git not detected" when running Storybook in Docker
Describe the bug
When running Storybook inside a Docker container, the "Visual tests" tab displays "Git not detected".
Git is, in fact, installed inside the container, and is able to see the project's repository. For example, git status displays modified files.
The Storybook output in the terminal where it was run includes:
[storybook] Unhandled promise rejection: Error: Command failed with exit code 1: git config user.email
[storybook] at jt (/srv/app/node_modules/chromatic/dist/chunk-X7RBQNLE.js:55:57)
[storybook] at /srv/app/node_modules/chromatic/dist/chunk-X7RBQNLE.js:56:1427
[storybook] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[storybook] at async F (/srv/app/node_modules/chromatic/dist/chunk-CQ77PNYM.js:35:106)
[storybook] at async Object.TJs (/srv/app/node_modules/chromatic/dist/chunk-Q3TNQW3L.js:1491:3219)
[storybook] at async fe (/srv/app/node_modules/@chromatic-com/storybook/dist/preset.js:33:8923)
[storybook] at async /srv/app/node_modules/@chromatic-com/storybook/dist/preset.js:37:293
[storybook] at async Ae (/srv/app/node_modules/@chromatic-com/storybook/dist/preset.js:34:137) {
[storybook] shortMessage: 'Command failed with exit code 1: git config user.email',
[storybook] command: 'git config user.email',
[storybook] escapedCommand: 'git config user.email',
[storybook] exitCode: 1,
[storybook] signal: undefined,
[storybook] signalDescription: undefined,
[storybook] stdout: '',
[storybook] stderr: '',
[storybook] cwd: '/srv/app',
[storybook] all: '',
[storybook] failed: true,
[storybook] timedOut: false,
[storybook] isCanceled: false,
[storybook] killed: false
[storybook] }
And indeed, when git config user.email is run inside the container, it does exit with code 1. No user email is configured inside the container.
To reproduce
- Run Storybook inside a container
- Authenticate the visual tests add-on with Chromatic
- Visit the "Visual tests" Storybook tab in the Addons panel
- See "Git not detected"
Environment
Host OS: Arch Linux Browser: Chrome 132.0.6834.83 Storybook version: 8.4.7 Visual Test Addon version: 3.2.4
Let me know if you would like information about docker (version, image details, etc.).
Workaround for now: pass the value of git config user.email to Docker as a build arg, and then during the build echo a .gitconfig file into the home folder in the image. 🙈
:rocket: Issue was released in v4.0.0 :rocket: