GitHub: How to fork a public repository as a subdirectory in a private repository?

git, github

Solution

This is called submodule and is described in details at http://git-scm.com/book/en/Git-Tools-Submodules

Problem

My project is currently hosted in a private repository. I'm looking to introduce a dependency to a third party library hosted in a public repository on GitHub. How can I fork the library so that it becomes a subdirectory in my project, but I can still sync from the trunk branch of that library?

Original source