Creat React App deploy on GitHub

版权声明:本文为博主原创文章,若转载请附上原地址~ https://blog.csdn.net/sinat_27088253/article/details/89640479

在将本地的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文件夹

猜你喜欢

转载自blog.csdn.net/sinat_27088253/article/details/89640479