简体   繁体   中英

Git commit fatal error

when I enter in console:

git init
git add .

all OK

when I enter:

git commit -m "final"

I get:

error: object file .git/objects/18/d50376886bb9702194048cd450960abe40d223 is empty
error: unable to find 18d50376886bb9702194048cd450960abe40d223
fatal: 18d50376886bb9702194048cd450960abe40d223 is not a valid object

what's the problem?

When you run git add . , whatever new and changed files you had in the current directory gets staged into git's version control. This is where the contents of the files gets stored as git objects available under .git/objects .

In your case, a new git object with the hash 18d50376886bb9702194048cd450960abe40d223 is created for this content which is stored as .git/objects/18/d50376886bb9702194048cd450960abe40d223

The problem looks like, after you ran the git add command, this file either did not get written to the hard drive correctly, or could have been deleted later or even corrupted due to some hard disk errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM