Current directory is not a git directory!
See original GitHub issueEvery time I try to commit with husky I get this error
husky > pre-commit (node v11.15.0)
Current directory is not a git directory!
husky > pre-commit hook failed (add --no-verify to bypass)
This error is happening only when husky is activated. I have used husky before and I never had this error.
my package.json
{
"name": "root",
"private": true,
"devDependencies": {
"husky": "^2.4.0",
"lerna": "^3.14.1",
"lint-staged": "^8.2.0",
"prettier": "^1.18.2"
},
"scripts": {
...
},
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
"prettier --write",
"git add"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}
OS: Ubuntu 18.04.2 LTS Node 11.15.0 Git: 2.17.1
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:8
Top Results From Across the Web
Error:Current directory is not a git directory! · Issue #627
I have this problem when I installed the new version of lint-staged. I think it may be because my .git is in the...
Read more >Check if current directory is a Git repository - Stack Overflow
If a git repository exists in the current directory, then git branch and git tag ... git tag : Getting tags of the...
Read more >Git error - Fatal: Not a git repository and how to fix it | Datree.io
A Git command needs to be run on a specific repository, so this error typically occurs when a Git command is run in...
Read more >Solving “Fatal: Not A Git Repository” (Or Any Of The Parent ...
This command will show the current state of the repository if the current folder is part of a Git repository.
Read more >How to Fix the “fatal: not a git repository” Error - ContainIQ
In short, the fatal: not a git repository error indicates that your current working directory isn't tracked by Git. If you find yourself...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Update to latest git version can resolve this issue.
This is bug with lint-staged. you can npm install lint-staged@8.1.7 solve this problem