GitHub存储库ID号是永久的吗?

GitHub v.3 API for repository data返回给定存储库的整数标识符.此标识符是返回数据中字段ID的值.在此示例中,它是数字1296269:

[
  {
    "id": 1296269,
    "owner": {
      "login": "octocat",
       ... stuff omitted for brevity ...
    },
    "name": "Hello-World",
    "full_name": "octocat/Hello-World",
       ... stuff omitted for brevity ...
  }
]

一旦将给定的标识符值分配给存储库,它是否会被重用,即使随后删除了存储库或其所有者帐户?换句话说,标识符是唯一且永久的,并且永远不会重复用于任何其他存储库吗?

在这种情况下,我并不仅仅意味着重命名存储库;这不会被视为在同一意义上“重用”它,也不会完全用其他内容替换存储库的内容.我试图明确地了解GitHub id值是否会被“回收”,如果你愿意的话.

(老实说,我在GitHub文档和网页上搜索过,但无论如何都找不到声明.如果我错过了,我会道歉并很乐意指出相应的文档.)

最佳答案 自2014年以来,
Ruby toolkit for the GitHub API依赖于GitHub id的唯一性:见
issue 483
PR 485.

当时(2014年),renamed repo were not supported,但从那时起(April 2015),they are

If you have information about the repo before it was renamed, you should have the id which is returned by the API. If you do then to have a resilient access to the repository, you just need to do

GET /repositories/1234

And you’ll always get the repository, regardless of whether the name changes (assuming you still have access to it).

点赞