Git sparse checkout for simple web deployment

。_饼干妹妹 提交于 2019-12-03 13:50:17

Aha - solved it. The problem was that by doing init it was creating an empty repository, so I couldn't do a checkout. (I don't know why the pull didn't work.)

Instead, do a clone , but use the -n parameter for "no checkout". This clones the git repository but leaves your working tree empty. Then set up sparse checkout. Then checkout just what you want.

To whit:

cd <parentdir>
git clone -n <url>
cd <repo_dir>
git remote add –f <name> <url>
git config core.sparsecheckout true
echo /<foldername>/ >> .git/info/sparse-checkout
git checkout <tagname>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!