Gemfile issues between gitlab and my localhost

Can someone please explain the Gemfile to me? I am using jekyll on my localhost to build my web pages and if I issue “Jekyll serve” then jekyll expects a Gemfile to be present in the root directory so it can check my ruby version (I think). However when I commit to gitlab and push the project for gitlab to host my webpage I get an error from gitlab to say that my Gemfile is inconsistent with Gitlab’s version of ruby. I think that what is happening is that Gitlab and I have different versions. So I have to make a second Gemfile. Now I have one for my localhost to run jekyll locally and I have to swap that with the Gemfile consistent with gitlab’s installation before I do a push to the gitlab server. This is a nuisance and I often forget to do it. Why doesn’t gitlab just link in its own Gemfile before it runs jekyll on my project? Or have I totally misunderstood the purpose of the Gemfile?