Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do submodules behave in github pages?

I have this github repository, which is a web page for an open source project I am working on:

https://github.com/o8/o8.github.com

According to github's documentation, this repository is special, as it builds a github-pages site everytime it receives a push. This site becomes available under http://o8.github.com. This works fine :-).

However, my repository contains a submodule under the folder /oxy. This is declared inside the file /.gitmodules with a public url (git://github.com/linepogl/oxygen.git). I expected that all the files inside this submodule would also be included in the github-pages site. This does not happen, or at least I don't know how to make it work.

For example, there is the file /oxy/hlp/index.html. I expected that the address http://o8.github.com/oxy/hlp/index.html would point to this file. Instead, I get a 404 error.

Any ideas?

like image 254
linepogl Avatar asked Nov 21 '11 13:11

linepogl


People also ask

How do GitHub submodules work?

A git submodule is a record within a host git repository that points to a specific commit in another external repository. Submodules are very static and only track specific commits. Submodules do not track git refs or branches and are not automatically updated when the host repository is updated.

Is using git submodules a good idea?

Git submodules may look powerful or cool upfront, but for all the reasons above it is a bad idea to share code using submodules, especially when the code changes frequently. It will be much worse when you have more and more developers working on the same repos.

When should you use submodules?

In most cases, Git submodules are used when your project becomes more complex, and while your project depends on the main Git repository, you might want to keep their change history separate. Using the above as an example, the Room repository depends on the House repository, but they operate separately.

What does git pull -- recurse submodules do?

Cloning a Project with Submodules If you pass --recurse-submodules to the git clone command, it will automatically initialize and update each submodule in the repository, including nested submodules if any of the submodules in the repository have submodules themselves.


1 Answers

Just figured out that the issue you face might be caused due to the wrong URL which you used for your submodule. The bottom paragraph in the related help page says that you should only use the read-only URL of the repository. So in case you used the git@... URL the submodule won't be included. Just use the https://... URL and it will be included and works fine.

Only downside is that this doesn't seem to work recursively :(

Cheers.

like image 106
pagid Avatar answered Sep 23 '22 10:09

pagid