I'm trying to get a list of an organisation's repositories, including private ones. The thing is, we have an enterprise deployment.
I've tried the solutions in How to list organization's private repositories via GitHub API?, but they're all related with an organisation using Github's servers, not an enterprise deployment.
Looking at the Get a repository docs, this seems fairly simple:
$ TOKEN="my_access_token_goes_here"
$ curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $TOKEN" \
https://github.example.com/api/v3/repos/example/a_public_repo
{
"id": 1234,
"node_id": "ayz3BCDE...",
"name": "a_public_repo",
"full_name": "example/a_public_repo",
"private": false,
"owner": {
...
},
So now I tried getting a private repo:
$ curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $TOKEN" \
https://github.example.com/api/v3/repos/example/a_private_repo
{
"message": "Not Found",
"documentation_url": "https://docs.github.com/enterprise-server@3.7/rest/reference/repos#get-a-repository"
}
The example/a_private_repo
does exist and my user does have write access to it (I regularly commit code to it).
The token has the repo:status
permission, which according to the docs:
Grants read/write access to commit statuses in public, private, and internal repositories. This scope is only necessary to grant other users or services access to private repository commit statuses without granting access to the code.
I don't get an authentication error, or a 403
error, so I don't know if I'm using a bad URL, an authenticaton problem, or something else.
Any help is appreciated! Cheers!