我使用ReactJS进行前端开发已经有一段时间了,现在我决定将自己的技能通过MERN(MongoDB-Express-React-Node)升级到全栈。我已经成功开发了我的MERN应用,但部署过程失败。
我试图使用“从GitHub到Heroku”的方法,在此方法中,您首先将所有内容上传到GitHub,然后从那里在Heroku上使用它。我什至无法将文件结构上传到GitHub,因此我正在寻求帮助。
我想知道也许我的文件结构是错误的,所以这里有一些屏幕截图,您可以这样理解:
当我尝试上传到GitHub时,出现以下警告:
warning: adding embedded git repository: client
跟着一堆提示...为什么会这样?我认为客户端和服务器都有单独的.gitignore文件,这可能是问题吗?
cd (to the directory where client and server are)
git init
git add .
此时,我不断收到警告:
warning: adding embedded git repository: client
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint:
hint: git submodule add <url> client
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached client
hint:
hint: See "git help submodule" for more information.
谢谢你的帮助。
我认为您使用过create-react-app。create-react-app也将启动git存储库。
只需删除./client/.git
然后再执行即可。那应该没问题。
cd ./client
rm -rf .git
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句