How do I prevent Git commit error (An internal error occurred...)?


Question: I used to be able to commit my Datical project using Datical GUI. Now I'm seeing an error when I try to commit my changes.

This happens when I right-click on my project > select Team > select Commit > type my commit message and press the Commit button. I get this error:

I didn't change anything on my side. Since I started seeing this error, I've also performed a clean install of Datical followed up installing drivers. I still get this error.

Looking into metadata.log file, I see this message (notice half way through this message: "Input did not match supplied length. 150 bytes are missing."):

!ENTRY org.eclipse.egit.ui 4 0 2017-08-31 17:31:20.283
!MESSAGE An internal error occurred
!STACK 0
org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of commit command
	at org.eclipse.jgit.api.CommitCommand.call(CommitCommand.java:277)
	at org.eclipse.egit.core.op.CommitOperation.commit(CommitOperation.java:255)
	at org.eclipse.egit.core.op.CommitOperation.access$7(CommitOperation.java:233)
	at org.eclipse.egit.core.op.CommitOperation$1.run(CommitOperation.java:197)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2326)
	at org.eclipse.egit.core.op.CommitOperation.execute(CommitOperation.java:207)
	at org.eclipse.egit.ui.internal.commit.CommitUI$2.run(CommitUI.java:220)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.io.EOFException: Input did not match supplied length. 150 bytes are missing.
	at org.eclipse.jgit.storage.file.ObjectDirectoryInserter.shortInput(ObjectDirectoryInserter.java:237)
	at org.eclipse.jgit.storage.file.ObjectDirectoryInserter.toTemp(ObjectDirectoryInserter.java:168)
	at org.eclipse.jgit.storage.file.ObjectDirectoryInserter.insert(ObjectDirectoryInserter.java:105)
	at org.eclipse.jgit.api.CommitCommand.createTemporaryIndex(CommitCommand.java:363)
	at org.eclipse.jgit.api.CommitCommand.call(CommitCommand.java:195)
	... 8 more
Answer: The solution to this problem is to set core.autocrlf=false.

The way to set this in Datical GUI is go to File > Preferences > Team > Git > Configuration.

If core.autocrlf is set to true, then change its value to false.

If not already set, click New Entry... button and provide these values:

Key: core.autocrlf

Value: false

Then click Apply and click OK. Restart Datical GUI and try committing your project again.

Copyright © Datical 2012-2020 - Proprietary and Confidential