Zia Qamar Zia Qamar - 1 month ago 3x
Git Question

Git commit message is giving error "Code 10 Abort: Empty commit message"

One of my git repository had corrupt blob object so i delete my .git folder and takes the same folder from another team member working on same project.
Then i changes user name and email.

After that i created a new branch, made changes in it and runs following commands

1: git add --all

2: git commit -m "my_message"

but it is giving following error

.git/hooks/commit-msg: 7: .git/hooks/commit-msg: [[: not found Code 10

Abort: Empty commit message

Can anyone help me with it?

hvd hvd

Your team member has a hook configured that is not portable and does not work on your system. (Specifically, it is most likely invoked using sh and assuming that sh is bash, but that isn't the case on all systems, and isn't the case on yours.) This hook is a custom script that runs when committing, after the commit message has been entered, but before the commit has been created. Hooks are specific to each copy of the repository, cloning someone else's repository doesn't give you a copy of their hooks. However, copying the .git folder in its entirety does give you a copy of their hooks.

Personally, if I were in your situation, I'd feel most comfortable to clone from that repository into a new one. This gets you a completely clean configuration, without hooks.

If you do not want to do that though, you can manually remove the hooks by clearing the .git/hooks directory.