-1

Let's say I have an internal web server (nginx) and I want it to serve a page with the content of the GITHUB repository, e.g. https://github.com/vibranze/test. Page from the repository must be served locally.

I've tried the article from https://help.github.com/articles/duplicating-a-repository/ but the synced repository is not browseable due to no index file.

How do I make the local repo browseable internally and looks exactly the same like what its master copy in github.com or if I've done it wrongly, what's the correct way to achieve it?

Any pointer or advice are greatly appreciated.

Thank you.

Vibranze
  • 3
  • 1
  • Why not just clone the repository then create an index file? – Leopold Joy Nov 14 '17 at 01:27
  • Thank you @LeopoldJoy, but how do I create an index file that is looks exactly the same as if I'm browsing github.com/vibranze/test page? – Vibranze Nov 14 '17 at 01:40
  • Do you mean you simply would like to render the README with markdown in a browser? – Leopold Joy Nov 14 '17 at 02:38
  • @LeopoldJoy I think my test page is a bad example. Let's use this Github repo for example - https://github.com/i0natan/nodebestpractices. I would like to have the same exact page hosted in my local web server with all its content serve locally. Hope I am clear enough :) Thank you. – Vibranze Nov 14 '17 at 02:46
  • Well I suppose you could just save a copy of the webpage from your browser and update all of the links manually so that they are local to your server; but this begs the question: why do you need to do this? – Leopold Joy Nov 14 '17 at 02:51
  • Thanks, but it has to be in automated way, i.e. in the form of bash script to sync the content regularly. It's a project I'm doing. Thank you. – Vibranze Nov 14 '17 at 03:05
  • Ok, maybe download the page (and all associated assets) using a method like [this](https://stackoverflow.com/questions/1581551/download-webpage-and-dependencies-including-css-images). You can then display the page with all assets, you'll just have to update any links to link to your local files. – Leopold Joy Nov 14 '17 at 06:51

1 Answers1

0

Short answer:

  • You need a local Git server which hosts a clone of your example repository from GitHub.
    If your local Git server includes a web UI, you can probably see something similar like what you see on GitHub.
  • If you want future changes in the GitHub repo in your local repo as well, you need to pull periodically from the GitHub repo to your local repo.

Long version:

1. Hosting Git repos on your local server

There are a lot of options (paid and free) for running a Git server on your own machine.
Some of them contain web UIs which look similar (but not exactly the same) like GitHub.

There's only one option to get 100% the same look: by spending money for a private installation of GitHub (but it's not cheap).

If you don't want to spend that much, there are free alternatives, for example GitLab. This is a hosted service like GitHub, but the code is open source and you can install a free version on your local server.

Here's an example of a "repository overview" page:
https://gitlab.com/gitlab-org/gitlab-shell

GitLab is only one example, there's a lot more - just google for "self hosted git" and you will find plenty.

2. Getting a clone of the repository from GitHub to your local server

To set this up, clone the repo from Github to your local machine once with the --mirror option:

git clone --mirror https://github.com/user/repo some/local/path

To update your local repo with the newest changes from GitHub, you need to run git remote update periodically.

Christian Specht
  • 35,843
  • 15
  • 128
  • 182