git add .报错warning: adding embedded git repository: carreport hint: You‘ve added another git...

git add . 时报错

  • $ git add .
warning: adding embedded git repository:xxxxxxxxxx
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>xxxxxxxxxx
hint:
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint:
hint: git rm --cached   xxxx
hint:
hint: See "git help submodule" for more information.

原因:
使用 git add . 时,出现上述错误。是因为在当前 git 仓库中同时包含有另一个git仓库。如当前仓库目录下的子文件夹内又是一个仓库。

解决:
删除子文件夹的.git文件, 重新add commit push

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
当执行命令"git ad ."时,出现了报错信息"fatal: not a git repository (or any of the parent directories): .git"。这个错误通常表示当前目录不是一个git仓库,或者当前目录的父目录中没有.git文件夹。 可能的原因有以下几种: 1. 当前目录并不是一个git仓库,你需要在一个已经初始化为git仓库的目录下执行git命令。 2. 当前目录是一个git仓库的子目录,但是.git文件夹可能被删除或者移动了。你可以检查上一级目录是否包含.git文件夹。 3. 当前目录是一个git仓库的子目录,但是.git文件夹可能被更改了名称。你可以在上一级目录中查找.git文件夹的正确名称。 为了解决这个问题,你可以按照以下步骤进行操作: 1. 确保你在一个正确的git仓库目录下执行git命令。你可以使用"cd"命令切换到正确的目录。 2. 如果当前目录是一个git仓库的子目录,请检查上一级目录是否包含.git文件夹。如果.git文件夹被删除或者移动了,你可以尝试重新初始化一个git仓库。 3. 如果.git文件夹的名称被更改了,你可以在上一级目录中查找正确的.git文件夹名称,并将命令中的".git"替换为正确的名称。 总结起来,出现报错"fatal: not a git repository (or any of the parent directories): .git"通常是因为当前目录不是一个git仓库,或者.git文件夹不存在或被更改了。你可以检查当前目录的git仓库状态,并根据具体情况采取相应的解决方法。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [git报错:fatal: not a git repository (or any of the parent directories): .git](https://blog.csdn.net/weixin_56243568/article/details/127292544)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [执行git命令报错:fatal: not a git repository (or any of the parent directories): .git](https://blog.csdn.net/weixin_43782998/article/details/128021553)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

jieyucx

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值