Travis CI Jekyll buildt build.sh 以 1 退出,找不到错误

Travis CI Jekyll buildt build.sh exited with 1, can't find error

我正在尝试使用 travis 构建一些分支 "travis",然后将其推送到我的 github 个人站点存储库的主分支。 构建时我得到的是

The command "./build.sh" exited with 1.

Done. Your build exited with 1

但是 Travis 没有给我任何真正的错误。我能够在本地构建站点。 这是一个完整的日志:

https://travis-ci.org/DavidSanwald/DavidSanwald.github.io/builds/184261084

这是我的 build.sh 脚本:

#!/bin/bash

# only proceed script when started not by pull request (PR)
if [ $TRAVIS_PULL_REQUEST == "true" ]; then
  echo "this is PR, exiting"
  exit 0
fi

# enable error reporting to the console
set -e

# build site with jekyll, by default to `_site' folder
bundle exec jekyll build
#find ./_site -name "*.html" -exec bundle exec htmlbeautifier {} \;
#bundle exec htmlproof ./_site --disable-external --check-html --verbose

# cleanup
rm -rf ../DavidSanwald.github.io.master

#clone `master' branch of the repository using encrypted GH_TOKEN for authentification
git clone https://${GH_TOKEN}@github.com/DavidSanwald/DavidSanwald.github.io.git ../DavidSanwald.github.io.master

# copy generated HTML site to `master' branch
cp -R _site/* ../DavidSanwald.github.io.master

# commit and push generated content to `master' branch
# since repository was cloned in write mode with token auth - we can push there
cd ../DavidSanwald.github.io.master
git config user.email "davidsanwald@users.noreply.github.com"
git config user.name "DavidSanwald"
git add -A .
git commit -a -m "Travis #$TRAVIS_BUILD_NUMBER"
git push --quiet origin master > /dev/null 2>&1

这是我的。travis.yml:

sudo: required
language: ruby
before_script:
- chmod a+x ./build.sh
script: "./build.sh"
branches:
  only:
  - travis
rbenv:
- 2.2.3
env:
  global:
  - secure: "long encrypted env variables"

我尝试了几件事,但我有点迷茫,因为我什至找不到有用的错误消息来开始,而且我可以在本地构建所有内容。所以我不知道从哪里开始。

编辑: 好的,删除了 --quiet 选项,他们重定向了输出。 不,我得到:

error: src refspec master does not match any.
error: failed to push some refs to 'https://f0f6a53cbfafecf9a0ccdd4d5121b5ca75f09cfd@github.com/DavidSanwald/DavidSanwald.github.io.git'

这是一个起点。如果我解决了它会回来。尽管如此,任何想法仍然值得赞赏。 撤销了上面的令牌。它只是在这里进行演示。

在 git 推送之前尝试 git 状态。

error message means 要么没有提交(这里不太可能),要么 refs/heads/master 不可用。

尝试 git push origin HEAD:master 看看是否有效。