reactjs - 如何在 github pages 中的 react 网页中进行更改?
问题描述
main
我已经在分支中成功部署了我的反应网页。有我的主要源文件,看看Main branch。部署后,分支gh-pages
包含所有必要的文件,其中包含静态文件夹和所有...看看这里gh-pages branch。
但是每当我在main
分支中更改时,它都不会反映网页。有什么办法可以推动我所有的变化?
gh-pages
恐怕我无法将更改推送到分支,因为它具有完全不同的文件。
我该如何进行这些更改?
我遵循了这些 git 命令,但它没有用
$ git add .
$ git status // to see what changes are going to be commited
$ git commit -m 'Some descriptive commit message'
$ git push origin master
$ git checkout gh-pages // go to the gh-pages branch
$ git rebase master // bring gh-pages up to date with master
$ git push origin gh-pages // commit the changes
$ git checkout master // return to the master branch
从这里引用
提前致谢...
解决方案
确保你的 package.json 文件中有这些脚本,然后你就可以运行npm run deploy
"scripts": {
//...
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
}
推荐阅读
- reactjs - 使用 ReactJS SPA 和 Django dj-rest-auth 进行 JWT 令牌身份验证和自动登录
- java - 在部署到 Azure 的 Spring Boot 应用程序中运行一次计划任务
- javascript - 如何在 JavaScript 中将值为 1.10 的数字转换为无损浮点值
- regression - 具有多个因变量的 Felm 函数
- sql - 如何将具有相同主键的多个表连接到每个键一行的表中?
- java - 具有潜在路径遍历的 SonarQube 漏洞
- excel - 自动过滤 VBA 宏排序从小到大
- c# - 我在 Google Cloud 上托管的服务之间的身份验证,使用服务帐户和签名的 JWT
- r - 对行之间分位数范围内的重叠进行分类
- java - 从 Azure blob storage 下载所有文件,压缩并上传 JAVA 压缩文件