git cat-file fatal: not a valid object name

Error: fatal: not a valid object name SHA1

You are probably getting this error when you try to run a similar command such as this one:
git cat-file -t 1f28ca2b5aac84a845f19354730e6eddd7ccc1

The reason that you are getting this error might be because your SHA1 is only 38 character long. Your SHA1 file has to be 40 characters long.
In order to get the 40 characters file name you have to concatenate the directory name to the SHA1 file.

Within you objects directory there are a whole bunch of directories (two characters long).

let's say you have a directory named: "ce" and within "ce" you have a file (SHA1) called :

In order to use the cat-file command on that file, you must use the following command:
git cat-file - t ce1f28ca2b5aac84a845f19354730e6eddd7ccc1

“You can see a file in the objects directory. This is how Git stores the content initially — as a single file per piece of content, named with the SHA-1 checksum of the content and its header. The subdirectory is named with the first 2 characters of the SHA, and the filename is the remaining 38 characters.”