I have complete all process
Firebase Login
Firebase init
Firebase deploy
now finally i got a link https://testing-37553.firebaseapp.com/
but my website not showing so what should i have to do.
What you are seeing is the default index.html page that is created by the CLI when you create a new project.
You should adapt this index.html page as you whish (i.e. by modifying the HTML/CSS/JS code of this page, in your local project directory) and re-deploy the project with
firebase deploy
or
firebase deploy --only hosting
Go to your firebase.json file and make sure that the 'public' key under "hosting" is set to "build" like below:
"hosting": {
"public": "build"
}
It was likely set to "public" by default when you ran firebase init. In which case it would look like this:
"hosting": {
"public": "public"
}
The problem with the default is that React places all your static assets in the 'build' directory when you run npm run build, so that is where you want to point firebase to.
I faced the similar issue, my application was on react built using create react app. I was trying to deploy via firebase but getting the default page of firebase then i figured out that I havent build my application so firebase was not able to find my application html file and hence it was trying to deploy the default one.
I solved it by running yarn build, then when I do firebase init selected "hosting" option . After this step while selecting folder to deploy rather public I selected "build" and this solved my problem and my application got hosted. Hope this helps!!
For Angular 8.
If the name of your project is "ManyuDictionary".
1)Run firebase login.
2)Run firebase init and choose:
a) hosting
b) What do you want to use as your public directory? dist/ManyuDictionary
c) Configure as a single-page app (rewrite all urls to /index.html)? Yes.
Firebase will now write configuration info to firebase.json and project
information to .firebaserc.
3)Run ng build --prod.This will replace the default index.html in dist/ManyuDictionary.
4)Run firebase deploy.
And here is your website [https://manyudictionary.firebaseapp.com].
For Angular 7+, here is the straight forward solution that works for me as of August-2019
Just delete the index.html file at the root of your /dist folder.
Then, copy all the content inside the directory(named like your project main project folder's name) found in your /dist folder
Lastly, rerun firebase deploy
Enjoyed!
Solution that worked for me as of 9/17/2020
1- Finish the firebase init steps.
2- Add this to your firebase.json file:
//"public": should be, dist + project name on your computer
//"site": should be the app name which you created on your firebase cloud
{
"hosting": {
"public": "dist/your-project-name",
"site": "firebase-project-name",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
3- ng build --prod
4- firebase deploy
Firebase asks wehn you type firebase init hosting.
File dist/your-project/index.html already exists. Overwrite?
Press
NO
And you are good to go!
If you follow firebase Hosting steps, but not solve your problem.Then you can follow this step for solving your problem:
Deploy your project in netlify.
Take the live project link from netlify.
Go to firebase > your project > Hosting > Dashboard.
Click the Add custom domain Button.
Paste the netlify project live link in input box.
Click the Continue button.
That's ok.
I am new to Firebase but I am the owner of a project.
I have also given permission to someone to be an "editor" of the project.
Initally there was only 1 site and URL for my project. In the hosting, I now notice that are 2 sites for the same project. One with the url mydomain.web.app and the other with mydomain-f9745.web.app.
When I deploy code it goes to the first domain and when the editor deploys it goes to the second domain. Can anyone explain what is happening here. It seems that when the editor deployed the code for the first time, it created a new domain instead of using the existing one.
I have also tried to see how I delete the second site but I don't see that option.
Can anyone explain why this second site it being created please?
once you set up firebase hosting you're automatically allocated with a domain .web.app.
Seems, like mydomain-f9745 might be the one that is the default one.
Anyway, you can add more web.app domains to your project like mydomain.web.app.
I'm not sure about the difference you're saying between just "deploying" and "deploying from your code editor".
Note that you can specify the default site to be deployed to on your firebase.json file like this:
{
"hosting": {
"site": "my-site"
/// other hosting config
}
}
Just add a "site" property inside "hosting", and enter the site name (Do EXCLUDE .web.app).
Hope this helps!
Using the Firebase console, I created a project and two apps, connected my own domain, and set up a few dynamic links.
Everything works perfectly!
Now I need to add some redirects in the hosting section in firebase.json. I have installed the CLI for this.
The problem is, I don't know how to get the firebase.json file generated by the console in order to modify it.
I've setup a custom domain to use for firebase Dynamic Links. Hosting has been setup in Firebase Console and I tried to use dynamic links without the customdomain, but just a xxx.page.link.
Now I want to return to use the custom domain, but from the console I'm told that:
A configuration already exists for this site. Add the snippet below to your firebase.json file and redeploy your changes. Be sure the rewrite rule is the first match for your dynamic link.
I'm not exactly sure how to handle this. Should I use the CLI and init a project to make this change or can I somehow do this from the portal itself.
If I need to use the CLI, how do I then access the existing project and make the change?
It seems you're already using Firebase Hosting outside of just for Dynamic Links. In that case you'll need to configure it through the CLI.
The configuration for Firebase Hosting must be made through deploying the firebase.json file through the Firebase CLI. There's no way to configure this directly in the Firebase console.
You can create an empty directory, run firebase init in there, and configure it to your existing project. Once that is done, you can create and deploy the minimal firebase.json file required as shown in the documentation on setting up your custom domain.
Today I have uploaded my website on Firebase hosting and in the process of doing that I have to create two rules files, one is storage.rules and another one is firestore.rules. I also have to create a firestore.indexes.json file. But I can remember previously I didn't have to create any such file while uploading another website on Firebas host.
I need to get rid of these 3 files, because every time I upload my files It changed to private rules for both storage and cloud which is unnecessary for me. I need to remain them public. Besides that I can't open these 2 rules files to edit (using Mac) just at least to see what is inside of them. How can I do it, Thanks!
It sounds like you use the Firebase CLI to initialize several products in the same project, including Cloud Storage and Firestore. If you don't want to work with these other products in your project files, you shouldn't select them during initialization.
The easiest thing to do would be to start over in a new directory and initialize only the products you want to use. It sounds like that's only Firebase Hosting.
You could also edit firebase.json and remove the products you don't want to use any more.
If you do want to work with Storage and Firestore, but you only want to deploy to Hosting, then just use firebas deploy --only hosting.