DEV Community

Himanshu Vishwas
Himanshu Vishwas

Posted on

Host React website with GitHub pages in ten simple steps.

Using Visual Studio Code.....

Step 1. First, add your repository using source control (Ctrl+Shift+G) on GitHub.
Step 2. Open terminal
Step 3.

git install gh-pages
Enter fullscreen mode Exit fullscreen mode

Step 4.
In package.json add following in first block before "name" :

"homepage": "https://<githubId>.github.io/<repoName>",
Enter fullscreen mode Exit fullscreen mode

Step 5. In package.json, inside "scripts" block, add the following after "start":

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

Enter fullscreen mode Exit fullscreen mode

Step 6. Save the file and open terminal

Step 7.git add .
Step 8. git commit -m "deploying webpage"
Step 9. git push
Step 10. npm run deploy

Top comments (0)