Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法使用octopress部署到Github页面_Git_Github_Octopress_Github Pages - Fatal编程技术网

无法使用octopress部署到Github页面

无法使用octopress部署到Github页面,git,github,octopress,github-pages,Git,Github,Octopress,Github Pages,我已经使用Octopress在github页面上建立了一个博客。我已经创建了我的第一篇文章,并且能够使用rake preview在localhost上查看它。但是,它无法部署到github页面。作为git的新手,我很难理解这个问题 我运行rakedeploy将其部署到github页面,并遵循它们的命令 我得到这个信息: ## Deploying branch to Github Pages ## Pulling any updates from Github Pages cd _deploy

我已经使用Octopress在github页面上建立了一个博客。我已经创建了我的第一篇文章,并且能够使用
rake preview
在localhost上查看它。但是,它无法部署到github页面。作为git的新手,我很难理解这个问题

我运行
rakedeploy
将其部署到github页面,并遵循它们的命令

我得到这个信息:

## 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.master.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 "master"]
    remote = <nickname>
    merge = <remote-ref>

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

See git-config(1) for details.
cd -
rm -rf _deploy/blog
rm -rf _deploy/robots.txt
rm -rf _deploy/javascripts
rm -rf _deploy/stylesheets
rm -rf _deploy/sitemap.xml
rm -rf _deploy/favicon.png
rm -rf _deploy/atom.xml
rm -rf _deploy/index.html
rm -rf _deploy/images
rm -rf _deploy/assets

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

## Committing: Site updated at 2014-01-25 20:13:51 UTC
# On branch master
nothing to commit (working directory clean)

## Pushing generated _deploy website
To git@github.com:slmnm/slmnm.github.io.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:slmnm/slmnm.github.io.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

## Github Pages deploy complete
cd -
你可能已经猜到了,我是一个人做这件事的,没有合作者(duh!blog)。这是我的。如果您需要任何其他详细信息,请告诉我。我是个新手:)谢谢

编辑:我还收到github的一封电子邮件,上面说:

页面生成失败,出现以下错误:

source/blog/archives/index.html
中包含了一个文件,该文件是 符号链接或不存在于您的
\u includes
目录中


这种情况只发生过一次,尽管我尝试过多次部署。

好的。我已经解决了这个问题。所以我要自己回答这个问题

我所面临的问题是因为我试图从octopress目录修复这个问题,而我应该从部署目录进行修复

在运行
rake deploy
时,octopress会执行
cd\u deploy
并尝试将更新推送到Github(在我的例子中)。在这段时间里,我收到了一条信息,“
你让我拉,但没有告诉我你是哪个分支……”

在此之后,在_deploy目录中,我运行了

git config branch.master.remote origin
git config branch.master.merge refs/heads/master

git pull
这修复了两个错误(上述错误和非快进错误)。现在将其推到远程(或再次运行
rake deploy


这对我有用。如果您有更好的解决方案,我愿意更改正确的答案。

当我们有多个分支,并且
git
无法识别要部署哪个分支时,就会出现此问题

在Rakefile中,您可以检查
deploy\u branch

deploy_branch = "master"  # For me its master
然后,在第250行附近的某个地方,有一个名为:push的任务,在
rake deploy

在此
:推送
任务

cd“#{deploy_dir}”do
之后,git pull就完成了

Bundler.with_clean_env { system "git pull" }
在这个命令中,git无法识别要部署哪个分支,所以我们只需要将上面的行更改为

Bundler.with_clean_env { system "git pull origin #{deploy_branch}" }

不适用于我:/我的解决方案是首先非常小心地备份我的git回购。然后,第二步,删除github上的主分支。这样我就可以在没有冲突的情况下解决任何问题(因为这是一个新的分支)。在运行rake deploy
之前,我搞砸了,并转到了我的“源”分支。在解决我的问题之前,我尝试了10种不同的方法。解决了我的问题!:D非常感谢。
Bundler.with_clean_env { system "git pull origin #{deploy_branch}" }