كيفية نشر موقع React على GitHub Pages


In GitHub

In “package.json”

  • Add:

"homepage": "https://XXX.github.io/YYY",

(XXX = GitHub UserName / YYY = Repo Name).

  • Under “scripts” add:

"predeploy": "npm run build", "deploy": "gh-pages -d build",

In Terminal (ctr + j)

  • Enter the following:

npm install gh-pages — save-dev
  • Upload your files to GitHub by enter:
    (Check the note at the end of the article before upload).

git init git add . git commit -m "first commit" git branch -M main git remote add origin https://github.com/XXX/YYY.git git push -u origin main
Join