2

I was attempting to commit some project changes in git bash. When I entered
git commit -m"my message"
I get the error
Aborting commit due to empty commit message.

I tried the solution from this post but I still get the same error.

What confuses me is that I wasn't having this problem before. The git commit -m"message" was working fine on device #1. The next day, I worked on device #2 and the commit command was working. On the same day, I also work on device #3, no problems with the commit command. When I come back to device #1, I am no longer able to commit any changes due to the abort message.

Hope this explains it more. Thank you in advance.

bunganga
  • 31
  • 5
  • Has any git hook been installed lately, like `pre-commit`, `prepare-commit-msg` and `commit-msg`? If `git config core.hookspath` is set, you can search the hookspath. If it's not, search `.git/hooks`. – ElpieKay Aug 05 '20 at 06:14
  • you did try to create a commit with the exact message `"message"`, correct ? – LeGEC Aug 05 '20 at 06:27
  • have you saved your file? – Tasnuva Leeya Aug 05 '20 at 07:18
  • As in case of any weird message maybe try to git clone again to fresh directory in device #1. Maybe something got accidentally corrupted in your current working dir. – Łukasz Ślusarczyk Aug 05 '20 at 07:18
  • @ElpieKayI haven't installed any hooks. I only learned about git through a java class I am currently taking. I'm working at a very basic level. – bunganga Aug 06 '20 at 05:42
  • @LeGEC My exact messaged varied every time I attempted `git commit -m` My first message was more detailed, but I've tried `"Updated files"` and I still get the same error. – bunganga Aug 06 '20 at 05:44
  • @Tasnuva I'm working in BlueJ so I believe the files save each time I compile the code. At the moment I have 2 files staged, ready to commit. I'm also in a separate branch from the master branch, not sure if that makes a difference. – bunganga Aug 06 '20 at 05:47
  • Does `git commit` without the `-m` option work as expected ? – LeGEC Aug 06 '20 at 06:06

1 Answers1

1

After the mention of corrupted files, I figured out OneDrive was the problem.

Not all my folders/files were syncing or loading to my pc from OneDrive. I copied the folder to a physical drive and was able to commit my changes.

Thanks for the help!

bunganga
  • 31
  • 5