IvanMih
IvanMih

Reputation: 1864

Cloning repository with submodules

I am trying to make a clone of a https://github.com/owncloud/news-iOS-App repository which contains several submodules. I've been pointed to do recursive cloning and did some searching on SO. It seems that it should be simple:

 git clone --recursive 

Unfortunately, that got me where i started, and i can't seem to figure it out. This is whole terminal dialog:

ctsi-macmini:Documents ivan$ git clone --recursive https://github.com/owncloud/news-iOS-App.git
Cloning into 'news-iOS-App'...
remote: Counting objects: 2973, done.
remote: Total 2973 (delta 0), reused 0 (delta 0), pack-reused 2973
Receiving objects: 100% (2973/2973), 6.88 MiB | 502.00 KiB/s, done.
Resolving deltas: 100% (1845/1845), done.
Submodule 'AFNetworking' (https://github.com/AFNetworking/AFNetworking.git) registered for path 'AFNetworking'
Submodule 'JCGridMenu' (https://github.com/joecarney/JCGridMenu.git) registered for path 'JCGridMenu'
Submodule 'KSCrash' (https://github.com/kstenerud/KSCrash.git) registered for path 'KSCrash'
Submodule 'MMDrawerController' (https://github.com/mutualmobile/MMDrawerController.git) registered for path 'MMDrawerController'
Submodule 'MMDrawerController-Storyboard' (https://github.com/TomSwift/MMDrawerController-Storyboard.git) registered for path 'MMDrawerController-Storyboard'
Submodule 'Objective-C-HTML-Parser' (git://github.com/tresni/Objective-C-HMTL-Parser.git) registered for path 'Objective-C-HTML-Parser'
Submodule 'PDKeychainBindingsController' (https://github.com/carlbrown/PDKeychainBindingsController.git) registered for path 'PDKeychainBindingsController'
Submodule 'SDWebImage' (https://github.com/rs/SDWebImage.git) registered for path 'SDWebImage'
Submodule 'TSMessages' (https://github.com/toursprung/TSMessages.git) registered for path 'TSMessages'
Submodule 'TUSafariActivity' (https://github.com/davbeck/TUSafariActivity.git) registered for path 'TUSafariActivity'
Submodule 'readable' (https://github.com/JanX2/readable.git) registered for path 'readable'
Cloning into '/Users/ivan/Documents/news-iOS-App/AFNetworking'...
Cloning into '/Users/ivan/Documents/news-iOS-App/JCGridMenu'...
Cloning into '/Users/ivan/Documents/news-iOS-App/KSCrash'...
Cloning into '/Users/ivan/Documents/news-iOS-App/MMDrawerController'...
Cloning into '/Users/ivan/Documents/news-iOS-App/MMDrawerController-Storyboard'...
Cloning into '/Users/ivan/Documents/news-iOS-App/Objective-C-HTML-Parser'...
Cloning into '/Users/ivan/Documents/news-iOS-App/PDKeychainBindingsController'...
Cloning into '/Users/ivan/Documents/news-iOS-App/SDWebImage'...
Cloning into '/Users/ivan/Documents/news-iOS-App/TSMessages'...
Cloning into '/Users/ivan/Documents/news-iOS-App/TUSafariActivity'...
Cloning into '/Users/ivan/Documents/news-iOS-App/readable'...
Submodule path 'AFNetworking': checked out '88f13053b1d1f20bf657f5c36459b87a5d317ad7'
error: no such remote ref 7375ddeb8db22b9c73c8db2ddd810652c23e19ea
Fetched in submodule path 'JCGridMenu', but it did not contain 7375ddeb8db22b9c73c8db2ddd810652c23e19ea. Direct fetching of that commit failed.

On the other hand, my teammate managed to clone some of the submodules on his computer calling the same command, but not the whole thing.

If you have any hints i would be grateful.

Upvotes: 0

Views: 635

Answers (2)

Holger Just
Holger Just

Reputation: 55718

In this case, the problem is that the parent repository at https://github.com/owncloud/news-iOS-App contains a submodule reference to the https://github.com/joecarney/JCGridMenu repository. The specific commit referenced there is not reachable (anymore) from any branch or tag however. It appears the commit was pushed by accident and later removed with a force-push again.

Thus, in general, your approach is fine. In this case, the parent repository has invalid references which need to be fixed by the repository owner.

Upvotes: 0

jAvA
jAvA

Reputation: 583

The normal procedure to check out submodule is

clone the MainProject then go to the project and run

$ git submodule init $ git submodule update

The other way is the one you did $ git clone --recursive . if you are still getting the error go to the .git directory and open the config file. make sure the submodule mentioned have the correct URL.

Upvotes: 1

Related Questions