Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to modify a deployed create-react-app on Github Pages?

Tags:

github-pages

I deployed a create-react-app on GitHub Pages using a mix of these 2 tutorials (https://create-react-app.dev/docs/deployment & https://github.com/gitname/react-gh-pages). It's working just fine.

But this webpage is supposed to evolve regularly, I have some content to add.

Is there a way to modify the deployed app? How can I push the changes I would make in my local directory to gh-pages (production mode)? Do I need to run npm build again after my additions?

For the moment I have the development mode on master branch. I think it's the build mode on gh-pages, although I don't have any other branch.

Thank you for your help.

What I did to deploy:

Terminal

$ npm install --save gh-pages

$ git init

$ git remote add origin https://github.com/REMOTE

$ npm run deploy

Package.json

{
    "homepage": "https://USER-PAGE.github.io/",  
    "scripts": {
        "predeploy": "npm run build",            
        "deploy": "gh-pages -b master -d build",
    },
    "devDependencies": {
        "gh-pages": "^2.1.1"
    }
}

1 Answers

To modify the site just make the changes and then git add, commit and push like one would normally do to the required branch.

Then again run the command:

npm run deploy
like image 76
Shivansh Avatar answered May 03 '26 00:05

Shivansh