# Jekyll, github and Travis ... for dummies

**URL:** <https://talk.jekyllrb.com/t/jekyll-github-and-travis-for-dummies/4669>\
**Category:** Uncategorized\
**Created:** [July 2, 2020, 5:48pm UTC](https://talk.jekyllrb.com/t/jekyll-github-and-travis-for-dummies/4669 "2020-07-02T17:48:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpc](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/jpc/32/2643_2.png) [@jpc](https://talk.jekyllrb.com/u/jpc)\
**Post date:** [July 2, 2020, 5:48pm UTC](https://talk.jekyllrb.com/t/jekyll-github-and-travis-for-dummies/4669/1 "2020-07-02T17:48:01Z")

</div>

Hello,  
I am a little bit lost with jekyll, github and travis …  
I developp my website on my own machine and I deploy it on github (gh-pages).  
As most of plugins are disabled on github, a guy suggested to use travis ci.

- I created an account on travis ci

- I created a file, .travis.yml, on my machine

- I wrote this:  
language: ruby  
cache: bundler  
sudo: false  
script: bundle exec jekyll build  
after\_sucess:

- I created a token in github for travis

- I past this token in my travis desktop \> myrepository \> setting \> environment variable

- I named it GH\_TOKEN

- I created and filled deploy.sh:  
#!/bin/sh  
cd \_site  
git init  
git config user.name “Travis CI”  
git config user.email “[travis@travis-ci.org](mailto:travis@travis-ci.org)”  
git add --all  
git commit --message “Auto deploy from Travis CI build $TRAVIS\_BUILD\_NUMBER”  
git remote add deploy https://$GH\_TOKEN@github.com/my\_name/my\_repository.github.io.git \>/dev/null 2\>&1  
git push --force deploy gh-pages \>/dev/null 2\>&1

- I made a modification in my website on my machine

- I deployed with the following commands:  
git add .  
git commit -m “version x.y.z”  
git push origin gh-pages

- on my travis desktop, for my repository: nil !  
I have the message “no buils for this repository”

why Travis didn’t receive data ?  
what is missing in my procedure ?

I also tried:  
more options  
trigger custom build with branch=gh-pages

My request was rejected  
In the requests menu, I have for each line:  
github pages branch not included via configuration

---

<div class="post-metadata">

**Author:** ![Uberfuzzy](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/uberfuzzy/32/878_2.png) [@Uberfuzzy](https://talk.jekyllrb.com/u/Uberfuzzy)\
**Post date:** [July 4, 2020, 3:47pm UTC](https://talk.jekyllrb.com/t/jekyll-github-and-travis-for-dummies/4669/2 "2020-07-04T15:47:17Z")

</div>

Commit the .travis files to your main branch also (probably called master, depending on when in time you read this)

Travis only uses the configs from the primary branch because of forks and things could expose or trigger things against someone’s will.

---

<div class="post-metadata">

**Author:** ![jpc](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/jpc/32/2643_2.png) [@jpc](https://talk.jekyllrb.com/u/jpc)\
**Post date:** [July 4, 2020, 4:15pm UTC](https://talk.jekyllrb.com/t/jekyll-github-and-travis-for-dummies/4669/3 "2020-07-04T16:15:20Z")

</div>

Side my machine, the site is in the gh-pages branch;  
Side github, the site is deplayed in the gh-pages branch;  
Don’t say why, I followed several tutorials …  
Side github, the master branch is empty: if I understood, this is the reason why Travis has no builds.

What can I do now ?

1. Push from my machine to the master branch instead of the gh-pages branch  
or
2. Side github, move the contents of gh-pages branch in the master branch

In both cases, I don’t know the procedure. If you could light me !  
In other words, how to clean the situation ?  
rgds,

---

<div class="post-metadata">

**Author:** ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)\
**Post date:** [July 11, 2020, 10:08pm UTC](https://talk.jekyllrb.com/t/jekyll-github-and-travis-for-dummies/4669/4 "2020-07-11T22:08:05Z")

</div>

Delete your gh-pages branch of github or delete the contents locally and commit and push the branch.

I’m not familiar with Travis but check the deploy automation section of docs [https://jekyllrb.com/docs/deployment/automated/](https://jekyllrb.com/docs/deployment/automated/)

---

<div class="post-metadata">

**Author:** ![MichaelCurrin](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.jekyllrb.com/michaelcurrin/32/2340_2.png) [@MichaelCurrin](https://talk.jekyllrb.com/u/MichaelCurrin)\
**Post date:** [July 11, 2020, 10:13pm UTC](https://talk.jekyllrb.com/t/jekyll-github-and-travis-for-dummies/4669/5 "2020-07-11T22:13:17Z")

</div>

If you follow the Github Actions flow there. you can deploy to GH pages using a copied workflow file of about 15 lines. (Use `GITHUB_TOKEN` in place of `JEKYLL_PAT`.)

That’s a lot simpler than running your own script and running it locally. And you can use any gems. There is a live example at the bottom of the GH Actions doc.

Also Netlify is a great alternative for building and serving your site.

Use whatever gems you want in Gemfile  
And build is as simple as

```auto
build: jekyll build

```

Note the GH Actions flow uses gh-pages branch to serve but Netlify stores build result on its own side so doesn’t need gh-pages branch
