Use Octokit to retrieve private repositories from organizations
Asked Answered
M

2

7

I'm trying to retrieve all repositories from a certain user's organization using the Octokit gem for ruby.

I have this client variable:

@client = Octokit::Client.new(access_token: TOKEN)

And when I use this:

@client.repos

I'm able to retrieve all repositories of the user (EVEN THE PRIVATE ONES FROM THE ORGANIZATIONS)

But with this

@client.repos(some_org_id)

I'm only getting the public ones from the some_org_id organization.

My OAuth token scope is set with the permissions:

repo, user, read:org

Am I missing something here? The API Documentaion mentions that the default value of repos privacy is all.

Thanks in advance

Myxomycete answered 4/2, 2016 at 0:37 Comment(0)
M
8

Ok, I was able to get the private repos doing the following:

@client.org_repos(some_repo_id)

I hope it helps someone.

Myxomycete answered 10/2, 2016 at 22:33 Comment(0)
G
1

According to this documentation:

client.org_repos('org_name', {:type => 'all'})

to get all repos at once and not just one. Then you can iterate through it with a loop.

Gregorygregrory answered 10/5, 2017 at 17:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.