git档案与cp -R [英] git archive vs cp -R
问题描述
如果我将git存储库的克隆作为远程服务器上的capistrano / vlad样式部署的缓存副本,那么最好做到以下几点:a)
git archive --format = tar origin / master | (cd#{destination}&& tar xf - )
或B)
cp -R缓存副本#{destination}&& rm -Rf#{destination} / .git
为了说明,存储库已经存在于远程服务器上,我只想在部署过程中将特定版本复制到同一服务器上的发布目录中。 实际上
rsync -avP / local / repo / * server:/ remote / repo
只要跳过仓库中的所有点文件,只要的.git
。如果您只想跳过 .git
,那么您需要 -f
选项和手册页。
我爱 rsync 。很好用,大多数时候你可以像使用scp一样使用它!
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.
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!
这篇关于git档案与cp -R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!