git archive vs cp -R

ott*_*bar 4 git capistrano vlad-deployer

如果我将git存储库的克隆作为远程服务器上的缓存副本进行capistrano/vlad样式部署,那么最好是做A)

git archive --format=tar origin/master | (cd #{destination} && tar xf -)
Run Code Online (Sandbox Code Playgroud)

或B)

cp -R cached-copy #{destination} && rm -Rf #{destination}/.git
Run Code Online (Sandbox Code Playgroud)

为了澄清,存储库已经在远程服务器上,我只想在部署期间将特定版本复制到同一服务器上的版本目录.

Nor*_*sey 8

我实际上是这么说的

rsync -avP /local/repo/* server:/remote/repo
Run Code Online (Sandbox Code Playgroud)

只要可以跳过回购中的所有点文件,这不仅可以.git.如果你想跳过只有 .git那么你需要的-f选项和手册页.

我喜欢rsync.效果很好,大多数时候你可以像使用scp一样使用它!