12

How do I change the Firebase project in my cli?

When I run firebase init, it says:

Before we get started, keep in mind:

  * You are initializing in an existing Firebase project directory

? Are you ready to proceed? (Y/n)

It never asks on which project do I need to upload. How can I link my other project?

halfer
  • 19,824
  • 17
  • 99
  • 186
user2828442
  • 2,415
  • 7
  • 57
  • 105
  • This first reminder is that the CLI will create `firebase.json` in the current directory. Only after that will it prompt you to select a project. Did you hit enter/press `Y`? – Frank van Puffelen Feb 01 '18 at 14:48

5 Answers5

14

The Firebase CLI will look in the current directory and all parent directories for a file called .firebaserc that defines which project is being used in this directory structure. If you run firebase init and encounter the message "You are initializing in an existing Firebase project directory", that means one of these .firebaserc files was found, and it's going to re-initialize this project.

If you no longer want the original project, just delete the .firebaserc file. Or, find another directory to run firebase init that isn't within another project's space.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
3

You could use firebase init with flag --project <projectId>

Maxim
  • 2,233
  • 6
  • 16
  • This didn't work (when paired with `--only firestore`, didn't try without it). I ended up manually changing the `"default"` project in `.firebaserc`. – Stratubas Jun 05 '20 at 14:03
2

Deleting .firebaserc did not work for me. I also had to delete firestore.json.

2

You need to delete .firebaserc and firebase.json file from the project directory. It works perfectly fine for me.

Prateek
  • 502
  • 5
  • 16
2

I create multiple project in Projects folder. Already try delete file from projects .firebaserc and firebase.json but not working.

Finally Follow the bellow steps: It works properly You can try this command to set new project from your Firebase project list

firebase use --add

Answer the question: What alias do you want to use for this project? (e.g. staging) "Write something"

And take step from start

firebase init
Tilok Paul
  • 41
  • 1
  • 4