Skip to content

husky.install to look for .git/hooks folder in cwd#18

Open
anoopmadhav wants to merge 3 commits into
spencerdcarlson:masterfrom
anoopmadhav:patch-1
Open

husky.install to look for .git/hooks folder in cwd#18
anoopmadhav wants to merge 3 commits into
spencerdcarlson:masterfrom
anoopmadhav:patch-1

Conversation

@anoopmadhav

Copy link
Copy Markdown

To fix the below mentioned error

... running 'husky.install' task
** (RuntimeError) '/home/.git' directory does not exist. Try running $ git init
    lib/husky/task/install.ex:40: Mix.Tasks.Husky.Install.create_scripts/2
    (mix) lib/mix/task.ex:301: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:75: Mix.CLI.run_task/2
    (elixir) lib/code.ex:376: Code.require_file/2

@spencerdcarlson

Copy link
Copy Markdown
Owner

Looks like the build failed, can you run mix format

@anoopmadhav

Copy link
Copy Markdown
Author

@spencerdcarlson My bad. formatted the code. Build passing now.

@spencerdcarlson

Copy link
Copy Markdown
Owner

I need to double check this. I'm thinking maybe we use

'git rev-parse --show-toplevel' 
|> :os.cmd() 
|> to_string()

to find the closest .git root

@anoopmadhav

Copy link
Copy Markdown
Author

Using git command makes more sense.

@zchbndcc9

Copy link
Copy Markdown

Status update on this PR?

@anoopmadhav

Copy link
Copy Markdown
Author

@spencerdcarlson I have made the changes, could you check it once.

@darksheik

Copy link
Copy Markdown

I also encountered this issue on my Mac.

mix husky.install
... running 'husky.install' task
** (RuntimeError) '/Users/don/.git' directory does not exist. Try running $ git init
    lib/husky/task/install.ex:40: Mix.Tasks.Husky.Install.create_scripts/2
    (mix 1.10.4) lib/mix/task.ex:330: Mix.Task.run_task/3
    (mix 1.10.4) lib/mix/cli.ex:82: Mix.CLI.run_task/2
    (elixir 1.10.4) lib/code.ex:926: Code.require_file/2

I can confirm that changing to this branch solves the issue for me.

@newt-beach

Copy link
Copy Markdown

sorry to bump an old thread, but any chance this could get merged into main @spencerdcarlson?
I'm encountering the same problem as darksheik, would rather not point my dep to a branch to fix. Thank you :)

@ShivamBang98

Copy link
Copy Markdown

Hey, I'm running into the same problem as well, could this be merged please? I would rather not point my app to a branch or change my git hooks to a different library.

@helderjnpinto

Copy link
Copy Markdown

Any updates on this i have the same issue ?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants