This can be done by setting up a sparse checkout. Sparse Checkout
Create a directory
mkdir [directory]
Enter directory
cd [directory]
Git init and add remote
git init git remote add origin [url]
Enable sparse checkout
git config core.sparseCheckout true
Set folders to checkout in .git/info/sparse-checkout
echo "[wanted directory]" >> .git/info/sparse-checkout
Then pull the repository
git pull origin master
This method will pull the whole repository but will only checkout the configured directories.