Closed Filiphasan closed 1 year ago
Hi @Filiphasan, Have you attached husky to one your projects? if not if you switch to a repo/branch that doesn't have all the husky files, you might encounter similar errors. or just check if you manually install husky again, would it fix the problem? I tried to reproduce the error but it is working on my two machines.
Hi @alirezanet
I manually configured the Husky for my project with the following tag in my .csproj file. I am experiencing the issue on macOS. When I tried it on Windows, I didn't encounter any problems. Thank you for your support.
<Target Name="husky" AfterTargets="Build" Condition="'$(HUSKY)' != 0">
<Exec Command="dotnet tool restore" WorkingDirectory="../" />
<Exec Command="dotnet husky install" WorkingDirectory="../" />
</Target>
Oh Unfortunately at the moment I only can test it in Linux/Windows operating systems, can you please verify if your git pre-commit hook have required permissions and it is executable on mac after installing husky? git hooks should have +x
permission
Yes, i have already +x permission
ls -l .husky/pre-commit
-rwxr-xr-x@ 1 hasan.erdal staff 162 Aug 25 11:20 .husky/pre-commit
well normally you have it, but I mean check it when you've faced the error... since the error message is:
fatal: cannot run .husky/pre-commit: No such file or directory
I think either the hook is missing for some reason or the hook doesn't have permission.
Hi @alirezanet,
I found the cause of my issue. My project has .gitattributes file for end-of-line settings and in this file there is "* text eol=crlf" settings for all files.
My old .gitattributes file
# Set end-of-line to CRLF for All files.
* text eol=crlf
And now
# Set end-of-line to CRLF for All files.
* text eol=crlf
# Exclude files or folders
.husky/** -text
This changes has solved my "fatal: cannot run .husky/pre-commit: No such file or directory" issues.
Thanks for your support
Hi @Filiphasan, thank you for letting me know, happy that you've managed to solve the problem. 👌
Version
0.5.4
Details
Hi, i have an issue for v0.5.4, my project already has pre-commit file in .husky folder
My pre-commit file is
My task-runner.json file is
My .confif/dotnet-tool.json file is
Steps to reproduce
It gives this error in different situations sometimes as well. For instance, I clone the project from scratch and then face this issue on a branch with Husky already installed. As far as I can understand, I encounter this error when changing branches locally.