git cat-file -p Fatal error : Not a valid object name

If you are trying to view the contents of git objects by accessing the name directly in its folder using: git cat-file -p
you’ll likely get the error “Fatal : not a valid object name”
which is annoying as you can see the file name appears exactly as shown
Screenshot from 2019-11-27 17-19-28

The reason for the error is that Git object names are paths to the file and not
the typical folder + file names you are used to.
In order to fix the issue you need to reference the full file name starting at the root object folder for Git to be able to find it.
In this example I would need to include the “1c” in the file name

Screenshot from 2019-11-27 17-33-53.png

One thought on “git cat-file -p Fatal error : Not a valid object name

Leave a comment