21
votes

I have firebase hosting working successfully in my project however I want to use the same database for a different site on a subdomain so I thought I would click add another site on firebase hosting.

I can configure the a records etc for the domain with no issues but am having trouble deploying content to the secondary site.

For example if I run firebase init and follow the prompts my .firebaserc looks the same in both my main project and my sub project.

{
  "projects": {
    "default": "<project-name-here>"
  }
}

Is there a way to tell the file which hosting site you are trying to deploy to? I have seen references to multiple databases here but I don't think this is relevant to what I am trying to do?

1

1 Answers

25
votes

You need to set deployment targets:

firebase target:apply hosting target-name resource-name

Where the parameters are:

  • target-name — a unique identifier (that you've defined yourself) for the Hosting site that you're deploying to

  • resource-name — the name of the Hosting site as listed in your Firebase project


Let me know if it works!

Source: https://firebase.google.com/docs/hosting/multisites