2016-12-15 51 views
1

我想用travis构建一些分支“travis”,然后将其推送到我的github个人网站存储库的主分支。 我所得到的,当建筑是Travis CI Jekyll buildt build.sh退出1,找不到错误

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

Done. Your build exited with 1 

但特拉维斯不给我任何真正的错误。我能够在本地建立网站。 下面是一个完整的日志:

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 "[email protected]s.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://[email protected]/DavidSanwald/DavidSanwald.github.io.git' 

这是一个起点。如果我解决了它,会回来。任何想法仍然赞赏。 撤消了上述标记。它只是在这里进行示范。

回答

1

在git push之前尝试一下git status。

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

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

+0

谢谢!你是对的。 'git show-ref'和我的参考文件搞砸了。 –

+0

不幸的是读取或'git update-ref'没有立即解决它。尝试了很多东西,我甚至不知道最后是怎么做的(对不起,意外地提交了我的评论,并且无法编辑它来添加其他内容) –