Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
LDevi2017
Frequent Visitor

How to connect GitHub private repositories with Power BI

Hello,

 

I am trying to connect GitHub private repository with Power BI desktop. When I try to pass the Web API key, then I am getting below error. 

LDevi2017_0-1719899488615.png

 

 

That API Key is generated from GitHub personal access tokens

LDevi2017_1-1719899198915.png

Using same key I can generate JSON file from Postman, it's working fine.

Can any one help me on this to connect GitHub private repository with Power BI desktop

 

Thanks in advance

2 ACCEPTED SOLUTIONS

Hi @LDevi2017 

You can try the following solutions.

1.Connect Power BI to Private GitHub Repo — Smoother Consulting

Put your useraccount of the github to the username, then put the API key to the password.

2.You can try the following code.

let

    apiUrl = "my_api_url",

    token="my_api_key",

    options = [Headers=[#"Authorization"="Bearer " & token ]],

    result = Json.Document(Web.Contents(apiUrl , options))

in

    #"result"

You can also refer to the following link.

Solved: A web API key can only be specified when a web API... - Microsoft Fabric Community

rest - A web API key can only be specified when a web API key name is provided - Stack Overflow

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

Hi @LDevi2017 ,

Thanks for your quick reply, you can try to refresh the datasource,

vxinruzhumsft_0-1720427539967.png

 

 

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
ferryv
Resolver II
Resolver II

This might be a bit late, but you can connect as follows (for example to retrieve repos in an org - I tend to use RelativePath as that allows for looping through different orgs too and doesn't cause the dynamic data source issues):

let
Source = Json.Document(Web.Contents("https://api.github.com/", [
RelativePath = "orgs/<org>/repos"]))

in Source

You don't need to add the header in as suggested below.

However, if your PAT does not work: 

- Use Git Bash to generate a token instead by logging in via git bash into Github using command: gh auth login and follow the prompts to authenticate via Git Bash with Github. Once logged in into Github use command gh auth token. This will generate a token starting with gho_ or similar. 

- For authentication in PowerBI, use Basic authentication. your username is your github username and your password is the token you generated above. Set the Privacy level as applicable, e.g. to Organizational if you're connecting to an Organisation.

 

Providing you have the right levels of access in Github (read:repos, etc), you can now see all public, private and internal info. It also means you don't have your token pasted as a string in your power query.

 

I tend to use this method and that seems to work fine.

 

LDevi2017
Frequent Visitor

I have connected using web option  and selected basic user name as API Key

LDevi2017_0-1719984404722.png

But after entered into power query result as below

LDevi2017_1-1719984520200.png

Actually JSON file need to load from this link. Can we able to convert this to table.

LDevi2017_2-1719984757818.png

Can I get any help

Hi @LDevi2017 

You can try the following solutions.

1.Connect Power BI to Private GitHub Repo — Smoother Consulting

Put your useraccount of the github to the username, then put the API key to the password.

2.You can try the following code.

let

    apiUrl = "my_api_url",

    token="my_api_key",

    options = [Headers=[#"Authorization"="Bearer " & token ]],

    result = Json.Document(Web.Contents(apiUrl , options))

in

    #"result"

You can also refer to the following link.

Solved: A web API key can only be specified when a web API... - Microsoft Fabric Community

rest - A web API key can only be specified when a web API key name is provided - Stack Overflow

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Thanks for your reply.

When I try to connect with Power BI desktop, till the repo it's reading.

i.e https://api.github.com/repos/owner/repo

But it's not reading till joson file and I can see blank result.

LDevi2017_0-1720426362159.png

 

Can you suggest me where I can check it exactly.

Hi @LDevi2017 ,

Thanks for your quick reply, you can try to refresh the datasource,

vxinruzhumsft_0-1720427539967.png

 

 

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Yolo Zhu,

 

I got the result on power query on yesterday once and again it shows blank result.

Can you suggest me what would be the reason and how can we solve.

 

Thanks,

Lakshmi

Hi Yolo Zhu,

 

Thank you very much. It's working perfectly.

 

Thanks,

Lakshmi 

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

Check out the April 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.