firebase init hosting:github, 404 error if the repo belongs to an organization
See original GitHub issueFirst 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
- Create an organization on Github.
- Upload your repo to your org and set it as the remote origin
- 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:
- Created 3 years ago
- Reactions:49
- Comments:17
I got this error on org repos too.
The solution for me was:
After that, I was able to run
firebase init hosting:github
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.