6

I need to retrieve all commits from Private repositories on github.

I already tried with with github API documentation. It provides the API for retrieving the public repository commits. https://api.github.com/repos/:owner/:repo/commits

Anybody can help me for taking all commits from private repositories?

Anoop
  • 1,415
  • 11
  • 20

2 Answers2

5

A private repository means you need to authenticate in order to execute your query (here getting the commits).
This should work, if you own the private repo:

curl -u 'username:password' https://api.github.com/repos/:owner/:repo/commits
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • How do you extend this to 2-factor auth? –  Dec 14 '16 at 08:11
  • 1
    @Feras Well... First, two-factor auth was not in place for GitHub at the time of my answer (Nov. 2012 vs. Sept 2013: https://github.com/blog/1614-two-factor-authentication) ;) Second, you need an X-GitHub-OTP header: http://stackoverflow.com/a/27747524/6309 or http://stackoverflow.com/q/20065691/6309 – VonC Dec 14 '16 at 08:18
0

You can also create Personal access tokens for specific use... here.

enter image description here

using postman:

https://api.github.com/repos/:owner/:repo/commits enter image description here

Farhan
  • 1,445
  • 16
  • 24