Get private repos stats with Github API and ruby

512 views Asked by At

How can I get stats about private repos in github with ruby code? What are the steps I need to do? I know about github api, but I have only succeeded to access public repo through curl command.

1

There are 1 answers

0
stef On BEST ANSWER

I found this guide very useful https://developer.github.com/guides/getting-started/ Getting the informations from private repos is explained step by step, so you can reproduce it with cUrl commands and then adapt it to Ruby.

For instance, to get stats on contributors :

curl -H Accept:application/json -u "yourlogin:yourpassword" https://api.github.com/repos/yourusernameororganization/theprivaterepo/stats/contributors

Note that putting the password in command line is not recommended but it's easier to understand that way.