Git commit failed with “invalid object”

Background

Issued “git commit” to commit changes to a git repository.

But, “NO GO“.

 

Error

Error Text

git commit -m "Cleaned-up file"
error: invalid object 100644 cf204b41d49794879c0e995ee81dedd809f0ebeb for 'README.md'
error: invalid object 100644 cf204b41d49794879c0e995ee81dedd809f0ebeb for 'README.md'
error: Error building trees

Error Image

gitCommit.invalidObject.01.20190826.1222AM

Possible Remediation

Outline

  1. git hash-object -w
    • ( did not work )
  2. git reset –mixed
    • ( did not work )
  3. Change Folder \ File permissions
    • ( worked )

Tasks

git hash-object -w

Tried to re-hash identified file.

Syntax


git hash-object -w 

Sample


git hash-object -w readME.md

Output

Output – Text

>git hash-object -w README.md
0c3ac4da715ab0d880d0071cf761513cb639517a

Output – Image

gitHash.01.20190826.1234AM

Explanation

Re-tried commit.

Did not help.  Same Error; “Invalid Object”

git reset –mixed

Tried to reset git repository

Syntax


git reset --mixed

Sample


git reset --mixed

Output

Output – Text

>git reset --mixed
Unstaged changes after reset:
M       README.md

Output – Image

git.reset.Mixed.01.20190826.1251AM

Explanation

Re-tried commit.

Did not help.  Same Error; “Invalid Object”

Folder Explorer

  1. Launched Windows File Explorer.
  2. Changed Options to show hidden files.
  3. Granted self full permission to hidden .git folder

Summary

In this case, our problem was not esoteric.

It was just a run of the mill, NTFS permission issue.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s