Creat React App deploy on GitHub

深藏阁楼爱情的钟 2022-04-24 15:00 266阅读 0赞

在将本地的react项目部署到GitHub上时,除了官方文档上介绍的那几步外,可能还会出现下面的两个错误。

  1. Failed to get remote.origin.url (task must either be run in a git repository with a configured origin remote or must be configured with the “repo” option).

解决办法:没有和远程仓库链接。可以用git remote来查看一下是否为空,若为空,需要用git remote add origin ...来添加远程仓库

  1. fatal: A branch named ‘gh-pages’ already exists.

解决办法:缓存中已经存在‘gh-pages’分支。解决办法需要将分支从缓存中删除,可以使用rm -rf node_modules/gh-pages/.cache,也可以直接去删除node_modules/gh-pages/.cache文件夹

参考资料:https://github.com/transitive-bullshit/react-modern-library-boilerplate/issues/15
https://github.com/tschaub/gh-pages/issues/192

发表评论

表情:
评论列表 (有 0 条评论,266人围观)

还没有评论,来说两句吧...

相关阅读

    相关 React学习(1)-create-react-app

    前言 如今,对于现今前端热门的三大框架Vue,Angular,React,对于web开发者来说,早已不是什么陌生的词 尽管三者实现业务最终的目的都能达成一致,但是各...