The Firebase CLI (GitHub) provides a variety of tools for managing, viewing, and deploying to Firebase projects.
Before using the Firebase CLI, set up a Firebase project.
Set up or update the CLI
Install the Firebase CLI
You can install the Firebase CLI using a method that matches your operating system, experience level, and/or use case. Regardless of how you install the CLI, you have access to the same functionality and the firebase command.
To download and run the binary for the Firebase CLI, follow these steps:
- Download the Firebase CLI binary for Windows.
- Access the binary to open a shell where you can run the firebase command.
- Continue to log in and test the CLI.
# Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo apt-get install -y nodejs
Install the Firebase CLI via npm by running the following command:
npm install -g firebase-tools
This command enables the globally available firebase command.
Log in and test the Firebase CLI
After installing the CLI, you must authenticate. Then you can confirm authentication by listing your Firebase projects.
Log into Firebase using your Google account by running the following command:
This command connects your local machine to Firebase and grants you access to your Firebase projects.
Test that the CLI is properly installed and accessing your account by listing your Firebase projects. Run the following command:
The displayed list should be the same as the Firebase projects listed in the Firebase console.
Use the CLI with CI systems
The Firebase CLI requires a browser to complete authentication, but the CLI is fully compatible with CI and other headless environments.
- On a machine with a browser, install the Firebase CLI.
- Start the signin process by running the following command:
- Visit the URL provided, then log in using a Google account.
- Print a new refresh token. The current CLI session will not be affected.
- Store the output token in a secure but accessible way in your CI system.
- Use this token when running firebase commands. You can use either of the following two options:
Option 1: Store the token as the environment variable FIREBASE_TOKEN. Your system will automatically use the token.
Option 2: Run all firebase commands with the --token TOKEN flag in your CI system.
This is the order of precedence for token loading: flag, environment variable, desired Firebase project. Glassmorphic UI In React Using CSS and HTML.