question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

firebase init hosting:github, 404 error if the repo belongs to an organization

See original GitHub issue

First off, I’m brand new to firebase hosting and github actions, so it’s entirely possible that I’m approaching this the wrong way, but I haven’t found any mention of this being incorrect in the docs.

To reproduce

  1. Create an organization on Github.
  2. Upload your repo to your org and set it as the remote origin
  3. Locally, use the command firebase init hosting:github

I authenticate successfully, then I’m prompted to enter the name of the repo, and it even suggests the correct repo in the format my-org-name/my-repo-name. So, I enter that but get the error FirebaseError: HTTP Error: 404, Not Found

Analysis

Looking at the firebase-debug.log, it looks like the cli makes the assumption that the repo belongs to a user, which isn’t correct in this case i.e. from what I entered, it’s forming the request: HTTP REQUEST GET https://api.github.com/repos/my-org-name/my-repo-name/actions/secrets/public-key?type=owner but the API is expecting: ...api.github.com/repos/my-github-username/my-repo-name/...

However, if I enter my-github-username/my-repo-name at the prompt, I get the same error but that’s because the repo doesn’t exist under my account, it belongs to the org.

Maybe it’s a limitation of Github’s API? Or maybe your intention is that developers always fork the repo, so this is more of a documentation issue (or lack of knowledge on my behalf)?

To work around this, I’m going to transfer the repo to my account, but I thought I’d mention it here.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:49
  • Comments:17

github_iconTop GitHub Comments

171reactions
alkikocommented, Dec 18, 2020

I got this error on org repos too.

The solution for me was:

  1. Open https://github.com/settings/connections/applications
  2. Select the Firebase CLI application
  3. Look for the section Organisation Access
  4. Click the “Grant” button next to the organisation you want to grant Firebase CLI access to

After that, I was able to run firebase init hosting:github

61reactions
najibghadricommented, Dec 29, 2020

I report this during a hackhaton 😄 : ALL you have to do is first grant Firebase CLI 3rd party github app in https://github.com/settings/applications and THEN do firebase init hosting:github. and enter it as organization/repo-name

If it’s not already among your integrated apps you can run firebase init hosting:github on a repo that YOUR username owns, because that will prompt you with the website to authorize Firabse CLI.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase hosting deploy error "HTTP Error: 404, Not Found"
My solution was to: delete .firebaserc file (contains your project alias) located in the root of the project; run firebase init and link...
Read more >
Deploy to live & preview channels via GitHub pull requests
In a local version of your repo, set up Firebase Hosting using the firebase init command. If you've NOT set up Hosting, run...
Read more >
Firebase Hosting: Preview and Deploy via GitHub Actions
Let Firebase CLI initialize your GitHub repository for automatic deploys. Several steps are taken care by the Firebase CLI for you.
Read more >
Host on Firebase - Hugo
In the root of your Hugo project, initialize the Firebase project with the firebase ... Choose “No” in the question if you are...
Read more >
Automate React builds to Firebase Hosting: Preview Channels ...
With CI/CD you can increase your pace when deploying your code to a ... will allow firebase-cli to initialize your Github repository for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found