如果这很明显,我很抱歉,但我无法弄清楚这把钥匙是什么!
{
"type": "file",
"encoding": "base64",
"size": 5362,
"name": "README.md",
"path": "README.md",
"content": "encoded content ...",
"sha": "3d21ec53a331a6f037a91c368710b99387d012c1", <<THIS KEY>>
"url": "https://api.github.com/repos/octokit/octokit.rb/contents/README.md",
"git_url": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1",
"html_url": "https://github.com/octokit/octokit.rb/blob/master/README.md",
"download_url": "https://raw.githubusercontent.com/octokit/octokit.rb/master/README.md",
"_links": {
"git": "https://api.github.com/repos/octokit/octokit.rb/git/blobs/3d21ec53a331a6f037a91c368710b99387d012c1",
"self": "https://api.github.com/repos/octokit/octokit.rb/contents/README.md",
"html": "https://github.com/octokit/octokit.rb/blob/master/README.md"
}
}
我用&lt;&gt;标记了密钥帮助。
https://developer.github.com/v3/repos/contents/#get-contents
答案 0 :(得分:1)
这是给定 blob的哈希,这就是Git在内部表示文件的方式。众所周知,提交有哈希值,但是so do all other Git objects:
Git是一个内容可寻址的文件系统。大。那是什么意思?这意味着Git的核心是一个简单的键值数据存储。您可以在其中插入任何类型的内容,它会为您提供一个可用于随时再次检索内容的密钥。
树,提交和标签是其他类型的Git对象。
要手动生成文件的哈希值,您可以使用hash-object
plumbing command:
$ git hash-object README.md
3d21ec53a331a6f037a91c368710b99387d012c1
对文件内容的任何 1 更改都会更改散列,但它不依赖于文件的名称或权限。
1 与所有加密哈希一样,重复哈希是可能的,但极不可能。