diff --git a/CHANGELOG.md b/CHANGELOG.md index b897142ec3b..395dacf70d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,3 +2,4 @@ - Fixes issue with filtering on a specific storage bucket using functions in the emulator (#3893) - Fixes check in Cloud Functions for Firebase initialization to check for API enablement before trying to enable them. (#2574) - No longer tries to clean up function build images from Artifact Registry when Artifact Registry is not enabled (#3943) +- Show error message when running `firebase init hosting:github` with no Hosting config in `firebase.json` (#3113) diff --git a/src/init/features/hosting/github.ts b/src/init/features/hosting/github.ts index 96a9c38a849..f1052d33de9 100644 --- a/src/init/features/hosting/github.ts +++ b/src/init/features/hosting/github.ts @@ -54,6 +54,13 @@ export async function initGitHub(setup: Setup, config: any, options: any): Promi return reject("Could not determine Project ID, can't set up GitHub workflow.", { exit: 1 }); } + if (!setup.config.hosting) { + return reject( + `Didn't find a Hosting config in firebase.json. Run ${bold("firebase init hosting")} instead.`, + { exit: 1 } + ); + } + logger.info(); // Find existing Git/Github config