2

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

shannoga
  • 19,649
  • 20
  • 104
  • 169
  • What version of git are you using? (because there was a bug in previous versions: http://stackoverflow.com/questions/10048783/git-submodule-add-fatal-not-a-git-repository). Or it could just be a naming conflict (http://stackoverflow.com/questions/10144149/git-status-returns-fatal-not-a-git-repository-but-git-exists-and-head-has-prop) – VonC Aug 19 '12 at 08:12

1 Answers1

1

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250