Git sparse checkout for simple web deployment -
i have directory structure this:
../dir1/dev/project1/... /project2/... /project3/... /production/
i have dev (and sub directories) checked git (and github). working well.
i use github deploy project2 checking out (or pulling, or whatever) production directory. (and specifically, want check out tag.) result in ../dir1/production/project2
i'm not git expert have read bunch online , seems 'sparse checkout' i'm after. i've tried various combinations of instructions here , here , here.
basically did:
mkdir <repo> && cd <repo> git init git remote add –f <name> <url> git config core.sparsecheckout true echo /project2/ >> .git/info/sparse-checkout
when git pull <remote> tagname
fatal: remote end hung unexpectedly
.
when git checkout tagname
error: sparse checkout leaves no entry on working directory
.
what doing wrong?
aha - solved it. problem doing init creating empty repository, couldn't checkout. (i don't know why pull didn't work.)
instead, clone , use -n parameter "no checkout". clones git repository leaves working tree empty. set sparse checkout. checkout 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>
Comments
Post a Comment