The second version of my personal website with React.
- Git clone the repo
- Install and use the correct version of Node and npm
# check version node --version npm --version
cd personal-website-v2
npm install
npm start
Edit files in src/assets/
-
The first time to deploy
- Create a new Github repository
- Change the react app name to what you want, may be the same as Github repository
- Search for all
personal-website-v2
, change toYour-app-name
- Search for all
- add remote repository
git remote add origin remote repository URL git push -u origin main
- install gh-pages
npm install gh-pages — save-dev
- go to
pakage.json
file and change to homepage property"homepage": "https://username.github.io/repository-name",
- Still in
pakage.json
file, add those two lines in the scripts propertyin my case it look like that:"predeploy": "npm run build", "deploy": "gh-pages -d build"
"scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "predeploy": "npm run build", "deploy": "gh-pages -d build" },
- Run
npm run deploy
locally to deploy- If success, will see
Published
in terminal - If you have set a domain, Sometimes, needs to set the Github Pages domain again.
- If success, will see
-
Ref: this link
-
Not the first time
- Run
npm run deploy
locally to deploy
- Run