WajeehHassan
WajeehHassan

Reputation: 596

Git pre-push issue no such file or directory

I'm using github for windows with git-lfs, committed the changes to the local branch which were done successfully, then gave an error after i tried to sync to the remote. Trying pushing my changes from the git shell and this error came up

error: cannot spawn .git/hooks/pre-push: No such file or directory
error: waitpid for .git/hooks/pre-push failed: No child processes

I then pushed by

git push --no-verify

it did get pushed but I tried downloading the files and they gave a 404 error. Any change that i commit gives the same error of the pre-push hook.

Upvotes: 13

Views: 14934

Answers (5)

moez cherif
moez cherif

Reputation: 101

Run :

git lfs update --force

And update theis file : .husky\pre-push

#!/bin/sh
npm run lint && npm audit && npm test

Then :

git push

Upvotes: 0

JBSnorro
JBSnorro

Reputation: 6736

I had to change the directory separation character in core.hooksPath to get rid of that error.

So e.g. in ~/.gitconfig I changed

[core]
   hooksPath = "C:\\Users\\MyUser\\MyHooks"

to

[core]
   hooksPath = "//c/Users/MyUser/MyHooks"

Upvotes: 0

Richard Tyler Miles
Richard Tyler Miles

Reputation: 683

In my case, the hook was in windows wsl with a non-existent shebang. A symlink using ln -s fixed the issue.

Upvotes: 1

Brackets
Brackets

Reputation: 572

Run git lfs update --force to override corrupted hooks.

Upvotes: 14

WajeehHassan
WajeehHassan

Reputation: 596

Found the solution. Deleted the pre-push hook in the .git/hooks folder Installed git lfs again. Issue was fixed.

Upvotes: 24

Related Questions