22

I have installed Firebase hosting project into my machine by referring following docs:

https://firebase.google.com/docs/hosting/

Now, I want to change the location of my project directory. Wha should I do for this?

Till now I have tried by relogin and re-initialize the project but it does not give option to specify directory again.

Faisal Shaikh
  • 3,900
  • 5
  • 40
  • 77

5 Answers5

43

Go to the file called firebase.json located in the root of the project and change the field called public in hosting to the directory you want.

{ 
"database": {
    "rules": "database.rules.json"
  },
  "hosting": {
    "public": "public", <------ This points to directory
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}

EDIT

learn more here

Community
  • 1
  • 1
Moddaman
  • 2,538
  • 3
  • 23
  • 41
3

In your npm command go to the directory that the folder is in and type firebase init Easiest way is to open Node.js and type cd "your_directory" without the q

1

Try these steps

1- create a new directory/folder somewhere on your computer 2- open your command line terminal e.g git/cmd from the created directory by doing the following a) for git: right click on directory and choose git b) for windows cmd: shift + right on created directory and choose cmd 3- type the command firebase init

Jobie J
  • 117
  • 5
0

Not sure if this is the best way, but none of the other solutions worked for me. I ended up copying the firebase.json file to the new folder I created. I opened the file and updated the public setting to the correct public folder (might be the same, but if you have a React app, you'll want "build" folder).

Then I did firebase init in the new folder through the CLI. This set the correct project folder.

-1

For the Firebase CLI use :

cd.. - Go back to previous directory

cd <dir_name> - To move to <dir_name> folder in current directory

JoelSebstn
  • 522
  • 4
  • 5