You are initializing in an existing Firebase project directory
Asked Answered
E

5

13

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?

Electrocardiogram answered 1/2, 2018 at 12:29 Comment(1)
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?Expansionism
B
15

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.

Bolo answered 1/2, 2018 at 17:9 Comment(6)
This is a brand new project and there is no firebaserc in itElectrocardiogram
As I suggested in my answer, you should also look in all the parent directories of the one where you're running the init. Did you do that?Bolo
I think yes may be because when I run firebase login, it said already logged in, now how do I find in which project that file is keptElectrocardiogram
This is a different project and firebase should ask me about this project, isn't itElectrocardiogram
You can't have a Firebase project live inside a folder on another project.Bolo
That's what I am trying to understand, this is a new ionic project :)Electrocardiogram
H
3

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

Henebry answered 9/3, 2019 at 10:38 Comment(1)
This didn't work (when paired with --only firestore, didn't try without it). I ended up manually changing the "default" project in .firebaserc.Lanellelanette
S
3

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

Slipway answered 15/1, 2021 at 5:21 Comment(0)
S
3

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
Schappe answered 4/5, 2022 at 11:52 Comment(0)
T
2

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

Thar answered 21/8, 2020 at 14:51 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.