'Need suggestion with Git commit Erro
I am getting this error on git and not able to commit changes any more. I have not worked on Git alot and not sure what I am supposed to do to get passed the error.
✖ EPERM: operation not permitted, open 'C:\Git\visualization…
↓ Skipped because of previous git error. [SKIPPED]
↓
✖ lint-staged failed due to a git error. [SKIPPED]
↓
✖ lint-staged failed due to a git error. [SKIPPED]
✖ lint-staged failed due to a git error.
Any lost modifications can be restored from a git stash:
> git stash list
stash@{0}: automatic lint-staged backup
> git stash apply --index stash@{0}
husky > pre-commit hook failed (add --no-verify to bypass)
When I do git status, it just gives me the name of the file that I need to commit
MINGW64 /c/git/visualization (405)
$ git status
On branch 405
Your branch is up to date with 'origin/405'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: map/components/Graph.tsx
I try to commit it git commit -am"Added font-family barlow"
It tries to process and I end up getting the above error message.
----------------Update 1.. Content of pre-commit----------- #!/bin/sh # husky
# Created by Husky v4.2.5 (https://github.com/typicode/husky#readme)
# At: 7/22/2020, 1:52:38 PM
# From: undefined (https://github.com/typicode/husky#readme)
. "$(dirname "$0")/husky.sh"
Solution 1:[1]
The repository you are working on has a pre-commit hook that is failing for some reason. A pre-commit hook is a script that git runs every time you make a commit.
You could probably bypass the hook by moving or deleting the .git/hooks/pre-commit file, but it would be best to look at what is inside that file and fix the underlying issue.
Solution 2:[2]
I was able to solve it by closing all my git applications and cmd lines. Seems like I had git bash application and git bash cmd line both open and they caused an overlap. Closed all that and error went away.
Solution 3:[3]
if you don't need to verify before commit, then: git commit -m "new commit" --no-verify
Solution 4:[4]
I got this problem once. I have tried to empty everything inside .git/hooks folder and it works. You can try this way.
Solution 5:[5]
In my case I forgot to track a file that was modified and I didn't pay attention to it. once i runned git add . again and it worked
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Adam Millerchip |
| Solution 2 | Sarah |
| Solution 3 | Timur Zamesov |
| Solution 4 | Isaac |
| Solution 5 | hakima maarouf |
