“不是git存储库:”尝试将RestKit添加到我的存储库时出错 [英] "Not a git repository: " Error when trying to add RestKit to my repository

查看:190
本文介绍了“不是git存储库:”尝试将RestKit添加到我的存储库时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我曾经(在过去)将RestKit克隆到我的项目中使用(我认为它是一个子模块但我不确定,现在一切都很好,我的文件的99%被跟踪并推送到Github。



当我尝试将RestKit /添加到我的存储库中时得到这个错误:
$ b


shanis-imac:shannoga-English-Club shannoga $ git add RestKit /
致命错误:不是git储存库:/Users/shannoga/github/shannoga-English-Club/.git/modules/RestKit


现在我可以猜到,我我不是推动休息套件,但以某种方式将它与我的存储库相关吗?


  1. 我是对吗?
  2. 错误的含义是什么

  3. 有什么方法可以做到这一点?

谢谢,Shani 解决方案

如果 ResKit 已经被声明为a您的当前GitHub项目中的子模块,您不应该克隆它/直接添加它(不是 git add 应该包含在内)。

关注 Git Tools - Submodules ,您应该:

  git submodule init 
git子模块更新

这将从所有数据中提取该项目并签出您的超级项目中列出的相应提交。

您的主要项目的 git clone --recursive 项目将为您包括此步骤:请参阅 git clone --recursive 来重新创建子模块的远程和分支?,并且不要忘记,如解释最后一个问题,即子模块在分离的HEAD模式中检出


I am trying to start using git with my project.

I had (in the past) cloned RestKit to my project for use (I think that as a submodule but I am not sure. Now everything is working great and 99% of my files are tracked and pushed to Github.

When I try to add RestKit/ to my repository I get this error:

shanis-imac:shannoga-English-Club shannoga$ git add RestKit/ fatal: Not a git repository: /Users/shannoga/github/shannoga-English-Club/.git/modules/RestKit

Now I can guess that I am not spoused to push rest kit but somehow to relate it to my repository?

  1. Am I right?
  2. What does the error mean
  3. What is the way to do that?

Thanks, Shani

解决方案

If ResKit is already declared as a submodule in your current GitHub project, you shouldn't have to clone it / add it directly (not git add should be involved).

Following Git Tools - Submodules, you should:

git submodule init
git submodule update

That will fetch all the data from that project and check out the appropriate commit listed in your superproject.

A git clone --recursive of your main project would have included this step for you: see "How do I get git clone --recursive to recreate submodules' remotes and branches?", and don't forget, as explained in that last SO question, that the submodules are checked out in a detached HEAD mode.

这篇关于“不是git存储库:”尝试将RestKit添加到我的存储库时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆