You're viewing the legacy docs. They are deprecated as of May 18, 2016.
Go to current docs

Firebase Hosting

Command Line

The Firebase command line tools allow you to deploy your application to Firebase Hosting. They also make it easy to deploy your Security Rules and access your Firebase data.

Setup

First Time Installation

The Firebase command line tools require Node.js and npm, which can both be installed by following the instructions on https://nodejs.org/. Installing Node.js also installs npm.

The Firebase command line tools require Node.js version 0.10.0 or greater.

Once you have Node.js and npm installed, you can install the Firebase command line tools via npm:

$ npm install -g firebase-tools

# or use sudo (with caution) if required by your system permissions
# sudo npm install -g firebase-tools

This installs the globally available firebase command.

Updating Previously Installed Firebase Tools

If you have a previously installed version of Firebase command line tools, you can easily update them to the latest version:

$ npm update -g firebase-tools

# or use sudo (with caution) if required by your system permissions
# sudo npm update -g firebase-tools

Commands

Initializing an Application

firebase init - Run this command in your project directory to initialize it for Firebase Hosting. Initializing a project will create a firebase.json file containing the configuration information needed for Hosting.

Deploying

firebase deploy - Deploys the current project (both assets and Security Rules) to Firebase Hosting and creates your subdomain on firebaseapp.com if it doesn't already exist.

Specifying the optional command line parameter -m or --message will allow you to include an optional version message, for example firebase deploy -m 'initial upload'.

For extra granularity you can specify firebase deploy:hosting to deploy only your site's static assets or firebase deploy:rules to deploy only Security Rules.

Security and Firebase Rules in your firebase.json file will overwrite any existing rules in your Firebase app.

Removing a Site

firebase disable:hosting - Removes Firebase Hosting from a specific Firebase and displays a "Site Not Found" page as if the site had never been deployed to.

Other Commands

firebase login - Account login for the command line tool. Logging in will automatically open a browser for you to authenticate.

firebase logout - Logs the command line tool out of Firebase.

firebase list - Lists the Firebase apps available to the currently logged in user.

firebase --non-interactive - Run in non-interactive mode for use in CI and headless environments. Will provide non-zero exit code on error instead of prompting for user response.

firebase --version - Displays the current version of the command line tool. Can also be written as firebase -v.

firebase --help - Shows a help screen. Can also be written as firebase -h.

firebase <command> --help - Shows detailed help for a specific command.