将React 应用部署至gitee、github page

1 、在gitee、或github设置设置gitxx pages

2、修改react中package.json   

               添加  "homepage": "https://pengfs.gitee.io/xxx/",根据实际域名

    在script 中添加      

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

3、命令行运行npm run deploy(确保npm run biuld可以正常),远程仓库中会生成一个新分支gh-pages

4、在gitee、github page中将页面管理到gh-pages分支。

 

 

注意:通过 git remote -v 查看,确保远程仓库唯一,比较多的可以通过 git remote rm xxx   git remote add xxx   https://gitee.com/xxx/yyy.git添加/删除进行调整。必要时可以通过-f push 强制覆盖。

 

posted @ 2020-10-01 23:49  SongPF  阅读(908)  评论(0编辑  收藏  举报