Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet husky install fails if .git folder is in the parent folder of the #C project #55

Closed
MichaelCharles opened this issue Oct 11, 2022 · 2 comments
Labels
need more information Need more information

Comments

@MichaelCharles
Copy link

Version

v0.5.2

Details

In my project we have a parent folder, project and then a child folder Project.Api that houses the actual C# project files.

I can install the tool as described in the documentation but when I run dotnet husky install from the Project.Api folder I get the following output.

.git can't be found (see https://alirezanet.github.io/Husky.Net/guide/getting-started)
Git hooks installation failed

The .git folder is in the parent project folder, so I guess that makes sense. If I change directories to the parent folder and try running it again, I get,

Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET program, but dotnet-husky does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

I attempted to install Husky globally and see if that eliminates this problem, but the output was the same afterwards.

I realize this might not be a bug and it might just be me using it in a way that was not intended. Any direction in how I could resolve this would be helpful.

Steps to reproduce

  • Create a new dotnet project
  • Put the new dotnet project inside a parent folder
  • Git init inside the parent folder
  • Attempt to install husky/run husky install
@MichaelCharles MichaelCharles added the bug Something isn't working label Oct 11, 2022
@alirezanet
Copy link
Owner

alirezanet commented Oct 11, 2022

Hi @mcaubrey,
I think You have checked out the Csharper library documentation and it might not be up-to-date, try Husky.Net documentation.

you missed the first important step in installation which is cd <Your project/solution root directory>.
also for attaching husky to your project the recommended way is use the attach command, more info here.

Husky will install in your repository, not your project, so you must install it from your parent folder.

@alirezanet alirezanet added need more information Need more information and removed bug Something isn't working labels Oct 11, 2022
@alirezanet alirezanet closed this as not planned Won't fix, can't repro, duplicate, stale Nov 5, 2022
@alirezanet alirezanet added the invalid This doesn't seem right label Nov 5, 2022
@alirezanet
Copy link
Owner

I think you forgot to remove or update the dotnet format task.

{
   "tasks": [
      {
         "name": "dotnet-format-example",
         "command": "dotnet",
         "args": [ "dotnet-format", "--include", "${staged}" ],
         "include": [ "**/*.cs", "**/*.vb" ]
      }, ....

@alirezanet alirezanet removed the invalid This doesn't seem right label Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need more information Need more information
Projects
None yet
Development

No branches or pull requests

2 participants