Skip to main content

How to deploy React app in Github Pages(gh-pages)

1.add
scripts{
...
"predeploy": "npm run build",
"deploy":"gh-pages -d build"
...
}
in package.json scripts part.

2.add "homepage":"https://username.github.io/reponame/" in package.json root
{
"name": "wordmemorizer",
"version": "0.1.0",
"private": true,
"homepage":"https://username.github.io/reponame/"
...
}

3. install
npm install -g ghp
npm install --save gh-pages

4. after installation execute npm run deploy

5.after npm run deploy in github repo new branch "gh-pages" automatically will be created.
go to repo settings in github.com and in GitHub Pages section change Source to gh-pages branch, otherwise it will show only readme file


Video:
https://www.youtube.com/watch?v=tf5qFEyOafw

Comments

Popular posts from this blog

GitHub ilə bir başa dummy server qurmaq

Integration üçün əlinizdə Json var lakin backend servicelər hazır deyil. Aşağıdakı linkdə istifadə edərək, dummy server istifadə edə bilərsiniz. Heç bir installation lazım deyil, sadəcə json-u atırsınız github-a və https://my-json-server.typicode.com/ <your-username>/<your-repo> formasında çağırırsınız. Vəssalam. https://my-json-server.typicode.com