https://github.com/newsoftwareculture/github-pages-react
React App with deploy to Github Pages
https://github.com/newsoftwareculture/github-pages-react
github-actions github-pages react
Last synced: 3 months ago
JSON representation
React App with deploy to Github Pages
- Host: GitHub
- URL: https://github.com/newsoftwareculture/github-pages-react
- Owner: NewSoftwareCulture
- Created: 2022-06-06T20:10:06.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-06T20:57:46.000Z (about 4 years ago)
- Last Synced: 2025-02-09T22:19:01.621Z (over 1 year ago)
- Topics: github-actions, github-pages, react
- Language: JavaScript
- Homepage: https://newsoftwareculture.github.io/Github-Pages-React/
- Size: 450 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# How deploy React App to Github Pages
> For Github Pages use `react-router-dom/HashRouter` instead `react-router-dom/BrowserRouter`
---
1. Create React App
```bash
npx create-react-app my-app
```
2. Run your React App
```bash
npm start
```
3. Add ssh url
```bash
git remote add origin REPOSITORY_URL
```
4. Add files to commit
```bash
git add .
```
5. Commit changes
```bash
git commit -m "init"
```
6. Push changes
```bash
git push origin master
```
7. Install package for github pages
```bash
npm install gh-pages --dev
```
8. Add deploy script in package.json
```json
{
"deploy": "npm run build && gh-pages -d build"
}
```
9. Add homepage in package.json
```json
{
"homepage": "https://NAME_ACCOUNT.github.io/REPOSITORY_NAME"
}
```
10. Deploy your React App to Github Pages
```bash
npm run deploy
```
11. Check your React App in https://NAME_ACCOUNT.github.io/REPOSITORY_NAME