为什么Git会在octopress rake部署中删除我的本地文件?

时间:2013-09-13 21:16:16

标签: ruby git github octopress

我正在设置Octopress,我的_deploy目录中有一个静态网站(包含一堆HTML文件和一些CSS等)。

当我做rake deploy时会发生这种情况:

$ rake deploy
## Deploying branch to Github Pages 
## Pulling any updates from Github Pages 
cd _deploy
You asked me to pull without telling me which branch you
want to merge with, and 'branch.gh-pages.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.

If you often merge with the same branch, you may want to
use something like the following in your configuration file:

    [branch "gh-pages"]
    remote = <nickname>
    merge = <remote-ref>

    [remote "<nickname>"]
    url = <url>
    fetch = <refspec>

See git-config(1) for details.
cd -
rm -rf _deploy/adintennis.html
rm -rf _deploy/assets
rm -rf _deploy/atom.xml
rm -rf _deploy/blog
rm -rf _deploy/CNAME
rm -rf _deploy/compversions.html
rm -rf _deploy/css
rm -rf _deploy/favicon.png
rm -rf _deploy/font
rm -rf _deploy/googlekjhaskjdhgkjhgas.html
rm -rf _deploy/images
rm -rf _deploy/img
rm -rf _deploy/index.html
rm -rf _deploy/javascripts
rm -rf _deploy/js
rm -rf _deploy/leadsriver.html
rm -rf _deploy/robots.txt
rm -rf _deploy/sitemap.xml
rm -rf _deploy/stylesheets

## Copying public/blog to _deploy
cp -r public/blog/. _deploy
cd _deploy

## Commiting: Site updated at 2013-09-13 21:09:43 UTC
[gh-pages some-hash] Site updated at 2013-09-13 21:09:43 UTC
 13 files changed, 56 insertions(+), 56 deletions(-)

## Pushing generated _deploy website
Counting objects: 51, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (22/22), done.
Writing objects: 100% (26/26), 1.96 KiB, done.
Total 26 (delta 14), reused 0 (delta 0)
To git@github.com:my-username/my-repo.git
   some...hash  gh-pages -> gh-pages

## Github Pages deploy complete
cd -

基本上它是删除'rake generate'未“生成”的每个文件。

1 个答案:

答案 0 :(得分:0)

之所以这样做,是因为每次运行rm -rf

时,默认Rakefile都配置为_deploy内的rake deploy个文件
(Dir["#{deploy_dir}/*"]).each { |f| rm_rf(f) } # line 254

您可能想要注释掉该行,并尝试再次部署。

此外:{/ 3}}附带的Octopress默认包含_deploy,因此您也希望将其从此处删除。