在将本地的react项目部署到GitHub上时,除了官方文档上介绍的那几步外,可能还会出现下面的两个错误。
- 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 ...
来添加远程仓库
- 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