Git rare check for easy web deployment

I have a directory structure like this:

../dir1/dev/project1/... /project2/... /project3/... /production/ 

I have dev (and all its subdirectories) checked on git (and github). Everything works well.

I would like to use github to deploy only project2, checking (or pulling, or something else) in my production directory. (And in particular, I want to check the tag.) That way, this will lead to ../dir1/production/project2

I am not a git expert, but I read a bunch of it online, and it seems like a โ€œrare checkโ€ is what I need. I have tried various combinations of instructions here and here and here .

I 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 I do git pull <remote> TAGNAME , I get fatal: The remote end hung up unexpectedly .

When I do a git checkout TAGNAME , I get error: Sparse checkout leaves no entry on working directory .

What am I doing wrong?

+7
source share
1 answer

Yeah, I decided. The problem was that, by executing init, he was creating an empty repository, so I could not perform the check. (I don't know why the craving didn't work.)

Instead, make a clone, but use the -n option for "no checkout". This clones the git repository, but leaves the working tree empty. Then set up a rare check. Then check what you want.

Down:

 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> 
+9
source

All Articles