diff --git a/src/server/index.js b/src/server/index.js index 6b7be5a0ee42..17a21fe5f95b 100755 --- a/src/server/index.js +++ b/src/server/index.js @@ -85,9 +85,9 @@ const configDir = program.configDir || './.storybook'; // The repository info is sent to the storybook while running on // development mode so it'll be easier for tools to integrate. -const exec = cmd => shelljs.exec(cmd).stdout.trim(); -process.env.STORYBOOK_GIT_ORIGIN = exec('git remote get-url origin'); -process.env.STORYBOOK_GIT_BRANCH = exec('git symbolic-ref HEAD --short'); +const exec = cmd => shelljs.exec(cmd, { silent: true }).stdout.trim(); +process.env.STORYBOOK_GIT_ORIGIN = process.env.STORYBOOK_GIT_ORIGIN || exec('git remote get-url origin'); +process.env.STORYBOOK_GIT_BRANCH = process.env.STORYBOOK_GIT_BRANCH || exec('git symbolic-ref HEAD --short'); // NOTE changes to env should be done before calling `getBaseConfig` // `getBaseConfig` function which is called inside the middleware