我想用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'
這是一個起點。如果我解決了它,會回來。任何想法仍然讚賞。 撤消了上述標記。它只是在這裏進行示範。
謝謝!你是對的。 'git show-ref'和我的參考文件搞砸了。 –
不幸的是讀取或'git update-ref'沒有立即解決它。嘗試了很多東西,我甚至不知道最後是怎麼做的(對不起,意外地提交了我的評論,並且無法編輯它來添加其他內容) –