This question has already been answered:

I study Git (link text) and came across this command:

ls -C .git/objects/<dir> 

and when I entered it into GitBash, I received the following error:

 sh: syntax error near unexpected token 'newline' 

I searched the whole Internet, I can not find how to fix it. The only thing I realized that the problem is contained in the "<>". Apparently, Git Bash does not understand brackets.

Shl. I agree that this question can be called duplicating, but the initial question was never given a sensible answer, and in my case the answer from Nick Volynkin is exhaustive.

Reported as a duplicate by members of aleksandr barakin , Pavel Mayorov , Community Spirit Jun 15 '16 at 10:22 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • one
    duplicate: www.stackoverflow.com/q/365314/178576 // but I cannot mark a duplicate, since there are no votes for the answer. - aleksandr barakin
  • @alexanderbarakin plus. Unfortunately, I already gave way to graphomania and dashed off the answer here. ) - Nick Volynkin
  • @alexanderbarakin did you notice how much the current edition is at odds with the first version? - Nick Volynkin
  • @NickVolynkin, because I instantly remembered that somewhere this question has recently been seen. noted duplicate. - aleksandr barakin
  • @Jonny please explain what you had in mind, completely replacing one question with another? - Nick Volynkin

2 answers 2

The syntax <что-нибудь> in technical documentation usually means <вместо этого слова в угловых скобках поместите сюда что-нибудь, имеющее смысл> . It is like a variable, only in pseudocode.

Git is a content-addressable database with a high-level interface for implementing the version control system itself. This means that all data objects are accessible by some key name. The name is SHA1 from the stored data.

Git will never create a folder that literally has the name .git/objects/<dir> . The .git/objects folder contains internal Git storage objects. Folders with names of two characters are created there, these characters are the first two characters of SHA1 from stored objects. The remaining 38 characters go to the file name.

For example, this is what is stored in the project repository, which I am working on right now. I sorted the results to show that several objects can be placed in one folder:

 find .git/objects/ -type f | sort | head .git/objects/00/79240fb1519c1f54a140dabaab61a0868812f9 .git/objects/00/d722b5a26f7a9c6cefae8fffc5bfaf1621454f .git/objects/05/bb369bb8ec8275763e3b14e0ff1f8926433b66 .git/objects/06/ec5c26beb527f457c1676193ed78413378193d .git/objects/09/01f512887ad7a6c6253ec3d41a08a47cb98453 .git/objects/0c/90057804fc85288be478e7efad5539a712b5c6 .git/objects/0c/fddc95209d2b4b62fd0afaee21843da2366b17 .git/objects/0f/91d370683076b354a1aa0fb3b33e17a7aa8951 .git/objects/11/1fdf8d2bfe8d18b2b5fc319176da807bba05ef .git/objects/12/04566e4266d8f50022300ce2c062e3b83079e1 

The .git/objects/00 folder contains two data objects. If you combine the folder name and file name, it turns out that their SHA1:

 0079240fb1519c1f54a140dabaab61a0868812f9 00d722b5a26f7a9c6cefae8fffc5bfaf1621454f 

By the way, in the tutorial on the link:

They are compressed and encoded, so viewing their contents will not help us much.

They just can't browse. Everything is very simple:

 git cat-file -t 0079240fb1519c1f54a140dabaab61a0868812f9 blob git cat-file -p 0079240fb1519c1f54a140dabaab61a0868812f9 | less (откроется содержимое файла, хранящегося в блобе) 

    Screen brackets

     $ ls -C .git/objects/\<dir\> ls: cannot access '.git/objects/<dir>': No such file or directory