I have 2 hosting in my project. I need to upload my application in other hosting. But in project lists its not showing other hosting option.
Steps i follow
npm install -g firebase-tools
firebase login
firebase init
then i select the project
and firebase deploy
but need to upload on second hosting
It sounds like you are working with two different projects. If you access those projects with the same Google account, you can add a second project to your local configuration with the firebase use --add command, as described in the documentation:
Add a project alias
When you select a Firebase project during project initialization, the
project is automatically assigned the alias of default. However, to
allow project-specific commands to run against a different Firebase
project but still use the same project directory, run the following
command from within your project directory:
firebase use --add
This command prompts you to select another Firebase project and assign
the project as alias. Alias assignments are written to a .firebaserc
file inside your project directory.
Then you can use that alias to switch projects.
firebase use project_id_or_alias Directs all commands to run against the specified Firebase project. The CLI uses this project as the currently "active project".
Read more of the documentation for more details.
If you have to use different Google accounts for each project, you will have to log out and log back in with the CLI each time you want to change.
You can change your project using this command firebase use <project_id>
and you can set your default project in .firebaserc
{
"projects": {
"default": "<project_name>"
}
}
You are looking for this
firebase target:apply hosting target-name resource-name
Read more Here
Related
I have created a GCP project using the following command...
gcloud projects create project-id --name=project-name
When I navigate to firebase console, there is no associated project. Is there a way I can create an associate firebase project, without having to go into the web console?
The Firebase CLI has a command projects:addfirebase, which add the Firebase bit to an existing Google Cloud project.
See https://firebase.google.com/docs/cli#management-commands
You can use the Firebase CLI to add Firebase to a GCP project.
firebase init
Select "Add Firebase to existing GCP project":
One can select a project to deploy their app to, using firebase use PROJECT_ID.
I've an interesting pattern - I've multiple firebase hosted applications (projects) on the different branches of a git repo, and I often need to switch between them. When I issue firebase deploy, often it picks the wrong project and deploy there.
Is there a way to configure the projectId for firebase hosting within my code, so that when changing branches, the right project is automatically selected for deployment?
Thank you.
So, I was wondering, is it possible to move a firebase hosting site to a different project?.
I searched through the documentation, but I dont see anything anywhere that says how to do it, or if it is even possible
There is no built-in operation to move to a new project. But if you're deploying with the Firebase CLI, you can run:
firebase use <new project ID>
And then:
firebase deploy
To deploy the same content to the other project.
If you have your code for the site then you can just create a new folder and use firebase init hosting and initialize hosting in new project.
After that the process of deploying remains the same i.e.
firebase deploy --only hosting
PS: Also if you are using any custom domains, you would have to verify the ownership of the domain again in the new project.
I have a problem with a web hosting project. I created a new proyect in google firebase, and I executed the following commands:
C:\myproject>firebase init functions
C:\myproject>firebase deploy --only functions
But the site says this:
Site Not Found
Why am I seeing this?
There are a few potential reasons:
You haven't deployed an app yet.
You may have deployed an empty directory.
This is a custom domain, but we haven't finished setting it up yet.
How can I deploy my first app?
Refer to our hosting documentation to get started.
What could I do for show, at least, some text when an user go to my project url?
The way you now invoke the Firebase CLI, it will only deploy the Cloud Functions in your project. It will not deploy the web site. In fact, the way you've run it, it probably didn't even create a web site to deploy.
Initialize the project with:
firebase init
And answer the questions this shows.
If you want to deploy the web site, use:
firebase deploy --only hosting
More likely you should simply deploy everything to prevent running into this problem:
firebase deploy
I want to try the demo for polymerfire in firebase. To get it run locally I followed these steps. But what exact steps do I need to do to get it to run in firebase?
I figured firebase init and firebase deploy should be run but the browser only displays errors in the console. Must the polymer project be build in a certain way and what should the firebase "public" folder be?
All files from public folder will be deployed to your Firebase static web hosting, so you can access them though your Firebase hosting address like https://projectname-5gek53.firebaseapp.com/. This allows you to upload your web app.
You build your polymer app (I guess you need to run polymer build). You drag all files generated as production build to your public folder. Next, you run firebase deploy and after deployment process your app will be accessible from your hosting address as I mentioned above.
Edit: Polymerfire demo is actually not that simple to export, but I found a really nice tutorial step-by-step from Google Codelabs here is a link Build a Progressive Web App with Firebase, Polymerfire and Polymer Components
I just installed a new version of the polymer cli and Firebase cli. When I do a Polymer build, no build/bundled or build/unbundled is created.
I do get a build/default, which I can run with a firebase serve and a firebase deploy. So something has changed recently. just fyi