Git submodules in Github repo

advertisements

In my project, im using a third party library. I had git cloned this lib in my project, and then had done git submodule init and git submodule update in the lib folder. I pushed my main project to github, but the contents of this third party lib were not sent and the lib folder appears like a green folder in my github project repo.

If i clone my main project on another machine, i dont have the contents of the lib there.So, should i git clone the lib again on the machine and run the init and update commands again or is there any way to push the contents of the 3rd party lib to my github repo ?

Thank You


Note that since April, 30th 2013, when you view a repository with a submodule on github.com, you get useful links and information for the submodule:

You now can see what exact reference a submodule points to.

The Repository Contents API will reflect that SHA1.

curl https://api.github.com/repos/jquery/jquery/contents/test/qunit

{
  "name": "qunit",
  "path": "test/qunit",
  "type": "submodule",
  "submodule_git_url": "git://github.com/jquery/qunit.git",
  "sha": "6ca3721222109997540bd6d9ccd396902e0ad2f9",
  "size": 0,
  "url": "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
  "git_url": "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
  "html_url": "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9",
  "_links": {
    "self": "https://api.github.com/repos/jquery/jquery/contents/test/qunit?ref=master",
    "git": "https://api.github.com/repos/jquery/qunit/git/trees/6ca3721222109997540bd6d9ccd396902e0ad2f9",
    "html": "https://github.com/jquery/qunit/tree/6ca3721222109997540bd6d9ccd396902e0ad2f9"
  }
}