addon-visual-tests icon indicating copy to clipboard operation
addon-visual-tests copied to clipboard

"Git not detected" when running Storybook in Docker

Open mmirus opened this issue 10 months ago • 1 comments

Describe the bug

When running Storybook inside a Docker container, the "Visual tests" tab displays "Git not detected".

Image

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

  1. Run Storybook inside a container
  2. Authenticate the visual tests add-on with Chromatic
  3. Visit the "Visual tests" Storybook tab in the Addons panel
  4. 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.).

mmirus avatar Jan 25 '25 19:01 mmirus

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. 🙈

mmirus avatar Jan 25 '25 20:01 mmirus

:rocket: Issue was released in v4.0.0 :rocket:

ghengeveld avatar May 28 '25 14:05 ghengeveld