How do I clone a subdirectory only of a Git repository?

EDIT: As of Git 2.19, this is finally possible, as can be seen in this answer. Consider upvoting that answer. Note: in Git 2.19, only client-side support is implemented, server-side support is still missing, so it only works when cloning local repositories. Also note that large Git hosters, e.g. GitHub, don’t actually use the Git … Read more