Monday, 21 October 2024

Push html file project on github.io and react js project

This is HTML 

1. Build the design with html and css.

2. Create repo on Github
2.1 repositories should be public
2.2 repositories name is : username.github.io

2.3 push the code on this repo: https://github.com/username/username.github.io

3. GitHub.io only indicates the main branch.

4. Fire up a browser and go to https://username.github.io.


--------------------------------------------------------------------

This is REACT JS

1. npm install gh-pages --save-dev

make sure run this command: npm run build isme koi error and warning nhi ana chahiye    

2. add this line in package.json

{

  "name": "react-app-oct",

  "version": "0.1.0",

  "private": true,

  "homepage": "https://username.github.io/",

// "homepage": "https://username.github.io/github-react-21-oct",  

"dependencies": {}


"scripts": {

    "predeploy": "npm run build",

    "deploy": "gh-pages -d build --repo https://github.com/username/username.github.io.git",

 // "deploy": "gh-pages -d build", pehle iske sath deploy karo nhi to uper wale ke sath

    "start": "react-scripts start",

    "build": "react-scripts build",

    "test": "react-scripts test",

    "eject": "react-scripts eject"

  },

----

ye sab add karne ke baad code ko push karna hai

phit ye run karna hai : npm run deploy


---

ye wali branch deploy hoti hai Gihub per, jb repo per click karoge to waha se "gh-pages" ye wai branch select karni hogi

gh-pages


Check GitHub Pages Settings

  • Go to the GitHub repository https://github.com/username/github-react-21-oct.
  • Ensure the Source is set to gh-pages branch, and save the settings.

No comments:

Post a Comment