5

The GitHub v.3 API for repository data returns an integer identifier for a given repository. This identifier is the value of the field id in the data returned. In this example, it is the number 1296269:

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

Is a given identifier value ever reused once it is assigned to a repository, even if a repository or its owner account is subsequently deleted? In other words, are the identifiers unique and permanent, and never reused for any other repositories, ever?

In this context, I don't mean simply renaming a repository; that would not count as "reusing" it in the same sense, nor would replacing the content of a repository completely with other content. I am trying to understand specifically whether the GitHub id values are ever "recycled", if you will.

(I honestly searched in the GitHub documentation and the web, but could not find a statement either way. If I missed it, I apologize and would be happy to be pointed to the appropriate documentation.)

mhucka
  • 2,143
  • 26
  • 41

1 Answers1

3

The Ruby toolkit for the GitHub API relies on the uniqueness of a GitHub id since 2014: see issue 483 and PR 485.

At the time (2014), renamed repo were not supported, but since then (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).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Is there any documentation for `id` field? I couldn't find anywhere on [GitHub API Documentation](https://developer.github.com/v3/), unfortunately. – Emadpres Jun 19 '18 at 10:05
  • @Emadpres I do not. Maybe GitHub support has more on that id. – VonC Jun 19 '18 at 20:56