madebymt
madebymt

Reputation: 367

Git commit API for GitHub Enterprise private repositories

I've been digging in the GitHub api documentation, but I'm still having an issue finding out about GitHub Enterprise private repositories (it's for my company's work).

I did get a result back using a regular person GitHub account using this link: https://api.github.com/repos/:owner/:repo/commits so I changed the owner to my company and repo name, but I just got this back.

{
  "message": "Not Found",
  "documentation_url": "https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository"
}

So the questions I have:

  1. How to get access to GitHub Enterprise repo APIs?
  2. Would visitors require a GitHub account to view this page?

Thank you.

Upvotes: 0

Views: 618

Answers (1)

bk2204
bk2204

Reputation: 76804

If you're trying to contact your company's GitHub Enterprise Server instances, you don't want to use https://api.github.com, since that's for GitHub Cloud (github.com). Instead, as mentioned in the documentation for GitHub Enterprise Server, you'll want to use https://hostname/api/v3 (where hostname is your server's hostname).

So if your company's server were example.com and you were looking up the repository octocat/spoon-knife, your request would go to https://example.com/api/v3/repos/octocat/spoon-knife/commits.

Note that you may require authentication for this request, depending on the repository; if the repository requires authentication and you lack it, you'll get a 404 response, even if the repository actually exists.

Upvotes: 2

Related Questions