tavis ci、jekyll、gh-pages:似乎无法推送到 gh-pages 分支

tavis ci, jekyll, gh-pages: can't seem to push to gh-pages branch

我正在尝试使用 Travis CI 构建我的 Jekyll 站点并推送到我在 Github 上的 gh-pages 分支。没用,我可能不知道自己在做什么。

错误是:
error: src refspec gh-pages does not match any.
error: failed to push some refs to 'https://github.com/jshwlkr/jshwlkr.info.git'

.travis.yml 此处:https://github.com/jshwlkr/jshwlkr.info/edit/master/.travis.yml

branches:
  only:
  - master
language: node_js
node_js:
- '6'
before_install:
- rvm install 2.2.3
- curl -o- -L https://yarnpkg.com/install.sh | bash
before_script:
- gem install bundler
- bundle install
- mkdir _site
- git clone https://$GITHUB_TOKEN@github.com/jshwlkr/jshwlkr.info.git -v --branch gh-pages _site
- git status

after_success:
- cd _site
- git config user.email "email.me@jshwlkr.info"
- git config user.name "jshwlkr"
- git add --all
- git status
- git commit -a -m "Travis #$TRAVIS_BUILD_NUMBER"
- git push --force origin gh-pages
- bundle exec rake webmention

此处最后构建:https://travis-ci.org/jshwlkr/jshwlkr.info/builds/268142486

(我最终要么推送到另一个服务器,要么 rsync。这就是那些评论。)

Travis 检查出一个浅克隆,因此您在构建 VM 上的本地副本不知道存在 on GitHubgh-pages 分支。尝试使用

获取分支
git fetch --unshallow

之前 运行 git push ….

或者,您可能想尝试 GitHub Pages deployment provider. There are a couple of reported bugs, such as https://github.com/travis-ci/travis-ci/issues/7538 and https://github.com/travis-ci/travis-ci/issues/7562,但您可能会发现它适合您的需要。