I have a repository that has two submodules. Git complains when I run git submodule init or git submodule update with the following error:
fatal: submodule mapping not found in .gitmodules for path 'AppName.xcodeproj / .. Vendor / AFNetworking'
My submodules were not in the same directory, and I decided to clean the project. I had a directory called Vendor that contained some of my submodules, but I followed the directions here to remove the submodule from git. Then I again added submodules to a new directory called submodules .
One of my submodules is the AFNetworking library, which I added as a submodule in the Vendor source directory. I deleted it a while ago and re-added it as part of the cleaning process. The app seemed like everything was fine, and my git submodule worked correctly. Now when I test another machine, it fails, as described above.
My .gitmodules file looks like this:
[submodule "submodules/AFNetworking"] path = submodules/AFNetworking url = https://github.com/AFNetworking/AFNetworking.git [submodule "submodules/LNPopupController"] path = submodules/LNPopupController url = https://github.com/MosheBerman/LNPopupController.git
This seems normal, since Git knows where my modules are, and everything should be fine. The same applies to my .git/config file:
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true [remote "origin"] url = git@github.com :MosheBerman/theshmuz.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master [submodule "submodules/AFNetworking"] url = https://github.com/AFNetworking/AFNetworking.git
The error is subtle, and it took me a while, but I noticed that the error message refers to an old Vendor directory that no longer exists.
I opened ./git/index , directing the output of cat to a text file and using a text editor. Of course, AppName.xcodeproj/../Vendor/AFNetworking/ will appear in the index. Could this be a bad gitlink? How to clean it so that I can initialize and build my repo as usual?