gpt4 book ai didi

git - 无法使用 octopress 部署到 Github Pages

转载 作者:IT王子 更新时间:2023-10-29 01:26:49 25 4
gpt4 key购买 nike

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

我运行 rake deploy 以部署到 github 页面,遵循他们的 documentation .

我收到这条消息:

## 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 -

正在关注 this question ,我已将我的 branch.master.remote 设置为 origin。为了解决非快进情况,我执行了 git push origin master。在此之后,我能够将代码推送到 github,但不能使用 rake deploy 部署到 github 页面。

我要在这里粘贴我的 git 配置文件,我不知道这是否有帮助。

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "octopress"]
url = git://github.com/imathis/octopress.git
fetch = +refs/heads/*:refs/remotes/octopress/*
[branch "source"]
remote = origin
merge = refs/heads/master
[remote "origin"]
url = git@github.com:slmnm/slmnm.github.io.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master

您可能已经猜到了,我是一个人在做这件事,没有合作者(呃!博客)。这是我的 repo .如果您需要任何其他详细信息,请告诉我。我是 git newb :) 谢谢

编辑:我还收到一封来自 github 的电子邮件,内容如下:

The page build failed with the following error:

A file was included in source/blog/archives/index.html that is a symlink or does not exist in your _includes directory.

这发生过一次,尽管我已经尝试部署多次。

最佳答案

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

我遇到的问题是因为我试图从 octopress 目录修复问题,而我应该从 _deploy 目录修复。

运行 rake deploy 后,octopress 会执行 cd _deploy 并尝试将更新推送到 Github(在我的例子中)。在那段时间里,我收到消息“你让我 pull 而没有告诉我你是哪个分支......

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

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

git pull

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

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

关于git - 无法使用 octopress 部署到 Github Pages,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21356212/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com