Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git archive vs cp -R

If I have a clone of a git repository as a cached copy on a remote server for capistrano/vlad style deployment, is it better to do A)

git archive --format=tar origin/master | (cd #{destination} && tar xf -)

or B)

cp -R cached-copy #{destination} && rm -Rf #{destination}/.git

To clarify, the repository is already on the remote server, and I just want to copy a particular version to a releases directory on the same server during deployment.

like image 677
ottobar Avatar asked Dec 05 '22 07:12

ottobar


1 Answers

I'd say actually

rsync -avP /local/repo/* server:/remote/repo

This works as long as it's OK to skip all the dot files in the repo, not only .git. If you want to skip only .git then you'll need the -f option and the man page.

I love rsync. Works great and most times you can use it just as you would use scp!

like image 116
Norman Ramsey Avatar answered Dec 28 '22 19:12

Norman Ramsey