<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/deploy-to-multiple-environments-with-firebase-hosting-hh6rtnssu" -->

---
title: Deploy to multiple environments with Firebase Hosting
description: A walkthrough of using the Firebase CLI to set up and deploy to multiple environments (development, staging, production) with Firebase Hosting. Covers adding a...
canonical: https://daily.dev/posts/deploy-to-multiple-environments-with-firebase-hosting-hh6rtnssu
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Deploy to multiple environments with Firebase Hosting | daily.dev
og:description: A walkthrough of using the Firebase CLI to set up and deploy to multiple environments (development, staging, production) with Firebase Hosting. Covers adding a...
og:url: https://daily.dev/posts/deploy-to-multiple-environments-with-firebase-hosting-hh6rtnssu
og:image: https://api.daily.dev/og/posts/HH6rtnsSu.png
og:image:alt: Deploy to multiple environments with Firebase Hosting
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Deploy to multiple environments with Firebase Hosting

**[Firebase](https://daily.dev/sources/firebase-blog)** · 2 min read · 0 upvotes · 0 comments

## Summary

A walkthrough of using the Firebase CLI to set up and deploy to multiple environments (development, staging, production) with Firebase Hosting. Covers adding a project alias with `firebase use --add`, switching between environments with `firebase use <alias>`, and deploying to a specific environment using the `-P` flag or `firebase deploy -P staging`.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://firebase.blog/posts/2016/07/deploy-to-multiple-environments-with>

## Questions this post answers

### How do I deploy to a staging environment using the Firebase CLI?

Add a second Firebase project as an alias using `firebase use --add`, select the project from the list, and name it something like 'staging'. Then deploy to it directly with `firebase deploy -P staging`, or switch the active environment first with `firebase use staging` followed by `firebase deploy`.

_Teams setting up safer release workflows can track Firebase Hosting tips like this on daily.dev._

### How can I switch between multiple Firebase projects from the command line?

Use the `firebase use` command with the alias name, for example `firebase use default` or `firebase use staging`, to switch the active project context. Aliases are created once via `firebase use --add`, after which any `firebase deploy` targets whichever alias is currently active.

_daily.dev helps developers keep up with CLI workflow changes across hosting platforms like Firebase._

## Similar posts on daily.dev

- [How To Set Up a Staging Environment on Heroku in 3 Easy Steps](https://daily.dev/posts/how-to-set-up-a-staging-environment-on-heroku-in-3-easy-steps-b09rmdwva) · Heroku · 1 upvotes · 1 comments
- [How to Build a Production-Ready Flutter CI/CD Pipeline with GitHub Actions: Quality Gates, Environments, and Store Deployment](https://daily.dev/posts/how-to-build-a-production-ready-flutter-ci-cd-pipeline-with-github-actions-quality-gates-environme-rpmoo0tv7) · freeCodeCamp · 1 upvotes · 0 comments
- [Managing Stages and Environments](https://daily.dev/posts/managing-stages-and-environments-2ysv40yn1) · Serverless · 0 upvotes · 0 comments
- [Using Flutter with Firebase: A Developer's Guide](https://daily.dev/posts/using-flutter-with-firebase-a-developer-s-guide-jbpavk3vl) · Flutter Community · 0 upvotes · 0 comments

---

Tags: [#cicd](https://daily.dev/tags/cicd), [#cli](https://daily.dev/tags/cli), [#firebase](https://daily.dev/tags/firebase)

[View this post on daily.dev](https://daily.dev/posts/deploy-to-multiple-environments-with-firebase-hosting-hh6rtnssu)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Deploy to multiple environments with Firebase Hosting","url":"https://daily.dev/posts/deploy-to-multiple-environments-with-firebase-hosting-hh6rtnssu","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/deploy-to-multiple-environments-with-firebase-hosting-hh6rtnssu"},"datePublished":"2026-08-23T12:20:18.087Z","dateModified":"2026-08-23T12:32:24.545Z","description":"A walkthrough of using the Firebase CLI to set up and deploy to multiple environments (development, staging, production) with Firebase Hosting. Covers adding a...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7ed721de96163685d26ab7e314be3ebc?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7ed721de96163685d26ab7e314be3ebc?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Firebase","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Firebase","logo":"https://media.daily.dev/image/upload/s--i395oqZH--/f_auto,q_auto/v1787487448/logos/firebase-blog?_a=BAMAMicg0","url":"https://daily.dev/sources/firebase-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/deploy-to-multiple-environments-with-firebase-hosting-hh6rtnssu","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"cicd,cli,firebase","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Firebase","item":"https://daily.dev/sources/firebase-blog"},{"@type":"ListItem","position":3,"name":"Deploy to multiple environments with Firebase Hosting"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/deploy-to-multiple-environments-with-firebase-hosting-hh6rtnssu#faq","mainEntity":[{"@type":"Question","name":"How do I deploy to a staging environment using the Firebase CLI?","acceptedAnswer":{"@type":"Answer","text":"Add a second Firebase project as an alias using `firebase use --add`, select the project from the list, and name it something like 'staging'. Then deploy to it directly with `firebase deploy -P staging`, or switch the active environment first with `firebase use staging` followed by `firebase deploy`. Teams setting up safer release workflows can track Firebase Hosting tips like this on daily.dev."}},{"@type":"Question","name":"How can I switch between multiple Firebase projects from the command line?","acceptedAnswer":{"@type":"Answer","text":"Use the `firebase use` command with the alias name, for example `firebase use default` or `firebase use staging`, to switch the active project context. Aliases are created once via `firebase use --add`, after which any `firebase deploy` targets whichever alias is currently active. daily.dev helps developers keep up with CLI workflow changes across hosting platforms like Firebase."}}]}
```

