I would love to use git to host my website, and would love a platform I can log into online to go along with it (something like Github). You would think in which case, that Github pages would be the perfect route for me, though I don't want to use Github pages. I would like to host this all on my own servers like you do with Github enterprise (but for free).

I have found Gitlab and was wondering if there is anyway I can use Gitlab like Github pages. Is it possible?

  • By gitlab-like you mean GitLab's markdown and ability to update website by just pushing to a git repo?
    – ek9
    Commented May 25, 2014 at 13:29
  • I mean having my website automatically update when I make a change in a gitlab repo, so yes. Commented May 25, 2014 at 17:36
  • 1
    GitHub Pages just uses Jekyll. So install that + a web server which serves static pages, and maybe throw in a few git hooks for automated deploys of pushed content, and you're basically done.
    – Ajedi32
    Commented Feb 13, 2015 at 16:17
  • Hey @Ajedi32 the problem with this approach is that for every new project you have the git repo and the web server setup. With GitHub pages it's just another branch that you push.
    – fiorix
    Commented Apr 26, 2015 at 2:11
  • @fiorix Yeah, if you want to automate things to that degree you'll probably need a somewhat more complex solution. Still doable though, you just need to hook in to the GitLab project creation system somehow (though I don't know how exactly, my guess is the simplest way would probably involve watching the filesystem, or perhaps some calls to the GitLab API).
    – Ajedi32
    Commented Apr 26, 2015 at 2:19

6 Answers 6


Good News!

Since 8.3 (Dec 2015) GitLab has "GitLab Pages". https://about.gitlab.com/2015/12/22/gitlab-8-3-released/

This feature is available on GitLab.com (which runs EE) where you can have free, unlimited repositories, public/private.

Here is documentation for GitLab Pages, explaining how you can host for free your static websites on GitLab. http://doc.gitlab.com/ee/pages/README.html


I'm not really sure what you're asking. You say you want to host on your own server but your question says you want to host like gitlab pages which is not your own server.

In any case maybe this will help

This is what I do

on local pc

mkdir folderforwebsite
cd folderforwebsite
git init
echo "hello world" > index.html
git add index.html
git commit -m "initial commit"

I now have a repo locally. Copy it to the server

scp -r ../folderforwebsite [email protected]:/path/from/root/to/webfolder

Now I have it on the remote server.

ssh [email protected] 'cd path/to/webfolder; git checkout -b live`

Now there's both a master and live branch on the website. I do this since AFAICT you can't push to the current branch. So now we have a "live" branch which is current on the remote and a "master" branch which is not

Finally add a remote to my local repo

git remote add web ssh://[email protected]/path/from/root/to/webfolder

Now, anytime I want to update the website I check stuff into my local master branch and then run this script

set -e
set -v
git push web master
ssh [email protected] git merge --ff-only master

The git push pushes my changes to the non-current branch on the webserver. The ssh then logs into the webserver and fast-forwards the changes in "master" to the current branch. In this case the "live" branch.

--ff-only says to fail if there are changes on the server.

If there are changes on the server I can pull them into my local master with

git pull web live

On more thing. Before I do any of this I setup SSH keys on the remote server so I don't have to type any passwords

This has absolutely no connection to github or gitlab. I might push my changes there as well but they're not connected.


There is a nodejs project that implements this: https://github.com/Glavin001/GitLab-Pages


With a little searching of various questions on Google, I found a way. It may not be the best way and it may be over complicated, but it should work and that's the main thing. Though, if you know a better way or can find one, please do let me know!

I found that you can deploy your code to your servers via Git hooks. All you need to do is SSH into your server, create a git repo and then set up a hook for you to push commits to this repo. This will allow you to push your commits to your servers, but has nothing to do with gitlab at this point.

The next step is to add the push url for gitlab to the same remote. This way, you will be pushing to both gitlab and the site itself each time. As a result, both the gitlab repo and the actual site will both be in sync. Though this is a hack and is definitely not efficient.

I found how to deploy your code to your servers via git from this blog post: http://sebduggan.com/blog/deploy-your-website-changes-using-git/

I found that you could add two push urls to your remotes in git from this question on stackoverflow: https://stackoverflow.com/questions/14290113/git-pushing-code-to-two-remotes

As I said, if you can find a better way, please do let me know. This will work, but it means having two versions of the same code. Of course, this is very messy and is a big waste of your server's storage.


Currently, the best you can do is to GitLab CI to push to a static server like Amazon S3.

If you can deploy with Git, the following (unsolved) question is specific to how to do it with gitlab: https://stackoverflow.com/questions/14288288/gitlab-repository-mirroring

There is a specific request for that at the feature tracker: http://feedback.gitlab.com/forums/176466-general/suggestions/5599145-preview-render-static-html-pages-pushed-to-repos


Well of course you can host your own community version of GitLab! Bitnami stacks make this very easy to host the community version yourself. That said, if you want a really cool website that just happens to have GitLab included, you will want to run something on a Linux server, probably with LAPP stack, install something like Joomla, or other CMS, and build awesomewebsite.com, then install GitLab to a subdomain like gitlab.awesomewebsite.com. And don't forget to set up SSL certificates with Let's Encrypt. Yes, that's a lot of work. Yes it's a chore, but well worth the effort, as you will only pay for the cost of electricity to run your machine from home. You have to check your usage with your ISP but personal or non-profit websites can be run on personal internet without incurring business class costs. If you need others to access this site, not just yourself, that is. You will have to set up your ISP router to Grant access to the webserver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.