Husky install: .git can't be found

See original GitHub issue

Environment: WSL Ubuntu, bash terminal Yarn workspaces + lerna monorepo

I’ve migrated from v4 to v6 as per instruction (https://typicode.github.io/husky/#/?id=migrate-from-v4-to-v6). The .git directory, package.json file and the .husky all live at the same level (INB4: https://typicode.github.io/husky/#/?id=custom-directory). Command husky install (@package.json, scripts.prepare) fails with “Error: .git can’t be found (see https://typicode.github.io/husky/#/?id=custom-directory)” message. I can assure you the .git dir is there and I have all the required permissions

The line that fails:

if (!fs.existsSync('.git')) {
    throw new Error(`.git can't be found (see ${url})`);
}

Thank you!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
harikumaraj07commented, Nov 17, 2021
1reaction
kanerucommented, Jun 12, 2021

@czescwojtek, thanks for the reply. I didn’t manage to solve my issue, but still your information you provided is helpful for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'husky install' fails if '.git' directory does not exists #851 - GitHub
I have a postinstall script in a NPM package: "postinstall": "is-ci || husky install", If I download the repository using Github UI (Code ......
Read more >
How to fix error 'not found husky-run' when committing new ...
I got this after running yarn install inside a unix-based Docker container and then committing on Windows. Windows was unable to run the...
Read more >
Husky - Git hooks
Modern native Git hooks made easy. ... Install. Install husky. npm install husky --save-dev. Enable Git hooks. npx husky install ... Command not...
Read more >
husky-init - npm
Install and setup husky quickly. Latest version: 8.0.0, last published: 8 months ago. Start using husky-init in your project by running `npm ...
Read more >
Get Started with Git Hooks and Husky - DEV Community ‍ ‍
Install Git Hooks ... These are the most common hooks available,as you can see they all have a .sample extension, what this those...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found