16

I want to use Gitlab to manage web-application development. Is it possible to access the html file I have created in my Gitlab repo from the browser?

Currently there are ssh/http url for access to the repo like:

ssh: git@something.some.ca:balbal/web-app.git   
http: (ht tps://something.some.ca:balbal/web-app.git)

When I access https from a browser it will just jump into the git repo manage UI (like show you all the commits, branches and detail files)

What I want is web access to a particular html file I have created in my repo (like if there is a index.html file in a folder called 'www' in my repo). I want some URL that I can type into the browser and which will show me the index.html content. Is it possible for me to set up an web access to these html files?

user3735448
  • 171
  • 1
  • 2
  • 6
  • do you want to access the index html in code or you want the page rendered? If you just want to see the code, you can use the link provided by the raw button on your repo page – Flmhdfj Jun 12 '14 at 19:50
  • i want to render it out @ShaRanShade – user3735448 Jun 12 '14 at 23:54
  • I think a webserver will be needed if i want to render it out right? The question then becomes how to set connection between web server and gitlab repo...@ShaRanShade – user3735448 Jun 13 '14 at 00:06
  • sorry I was busy. After some searching, I think it's possible to have github host your index page. This article might have what you want. http://blog.teamtreehouse.com/using-github-pages-to-host-your-website – Flmhdfj Jun 13 '14 at 03:24

4 Answers4

8

As of now, Gitlab does not support this functionality. There's a feature request for this: http://feedback.gitlab.com/forums/176466-general/suggestions/5599145-preview-render-static-html-pages-pushed-to-repos

Currently, if you query Gitlab for the raw html file, it sets certain HTTP headers to make it render as text/plain instead:

$ curl -I http://my-gitlab/user/project/raw/dev/doc/_book/index.html
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 20 Apr 2015 13:17:48 GMT
Content-Type: text/plain; charset=utf-8
Connection: keep-alive
Status: 200 OK
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-UA-Compatible: IE=edge
Content-Disposition: inline; filename="index.html"
Content-Transfer-Encoding: binary
Cache-Control: private
ETag: "b81191c550c47eae1ab4adf72dfd0c92"
Set-Cookie: request_method=HEAD; path=/
X-Request-Id: 04ae0499-2fdf-4f89-82ab-8392a8d6a076
X-Runtime: 0.019857
fiorix
  • 3,151
  • 3
  • 17
  • 12
3

Fortunately, with GitLab 10.1, online display of HTML files is now officially supported.

See the documentation for more details.

With GitLab 10.1, we introduce the online visualization of HTML files created by pipelines for public projects, just one click away from the artifacts browser view.

Alex Gru
  • 81
  • 2
  • 6
0

For quick debugging/testing purposes you may use the FireFox PourBico plugin.

Change the response header to text/html

Avoid doing this on the public GitLab, do this on your own GitLab deployment, GitLab was not meant to be hacked like this.

Also see Github pages, HTTP headers

Community
  • 1
  • 1
Christophe Roussy
  • 13,732
  • 2
  • 75
  • 75
0

For Chrome, one can use extensions such as Header Hacker and set the headers to render HTML by changing the content-type in the browser. As mentioned by Christophe Roussy this is a hack and you should really have a good reason for doing this.