部署react到github上

这个弄了我一晚上.......

1.写好react项目

2.在你当前项目下,右键鼠标,然后点击git bush here 

然后 输入命令:

git init

git add .

git commit -m "first commit"

git remote add origin https://.....(your github address)

git fetch origin

git merge origin/master

git push origin master

参考博客:https://segmentfault.com/a/1190000010544638

3.把你的项目都 弄上去后,可以打开你的webstrom 了,然后:

接下来是用github上的gp-pages进行部署

4.因为你把这个文件夹同步到github上来,所以你本地的操作会影响github的(github不能上传大于50M的单个文件哦)

5.接下来参考这个博客进行操作:https://www.jianshu.com/p/02c86540d324

6.注意,在第五点的博客中:要把
npm install gh-pages --save-dev

写为

cnpm 

因为 我之前配置过镜像

7.配置完之后,打开github上的仓库,你会发现原先的项目多了一个gh-pages分支,里面存放的是我们打包编译完成之后的静态文件。

如果找不到的话,就打开github的setting 然后选择branch ->gh-pages 就会发现有了。

8.然后根据你写的 

"homepage": "https://xfishhh.github.io/cxylove",这个,你就能访问到你的项目啦!!!


9.大功告成啦!等2019.12.31

猜你喜欢

转载自www.cnblogs.com/1starfish/p/12081747.html