背景:最近在做一个react 项目的权限管理,用node模拟了一个后台服务,然后在github创建了一个仓库,把node后端,和react前端项目,都放到这个仓库里。
问题:在上传代码是Node项目,上传正常,但是在上传react项目时,一直上传不成功,只有一个react项目的文件夹名,内容为空, 提示:warning: adding embedded git repository: myreact 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> myreact hint: hint: If you added this path by mistake, you can remove it from the hint: index with: hint: hint: git rm --cached myreact hint: hint: See "git help submodule" for more information. 原因:原来是react项目会被认为是一个仓库,这样出现了仓库中,包含了另一个仓库,所以就要用到submodule相关的知识了 解决方案: 网上找的解决方案有以下,测试都无效,大家可以测试下,因为我在react项目中,找了半天也没有找到git相关的文件,以就没有用这些解决方案了,最后,两个仓库合中一个使用,将Node服务的代码,也放到了react的项目中,解决了这个问题 方法如下: 删文件的解决方案 进入到每个目录下,把.git 这个目录删了。这样就可以继续提交代码了。 submodule方式解决方案 还未研究,据说有点麻烦。 忽略文件解决方案 把这个目录写进.gitignore文件就好 参考:https://studygolang.com/articles/13320?fr=sidebar |
|
|