Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Pilot Lvl 1
Message 1 of 6

How do I have a live site and a dev site in a single repo

Solved! Go to Solution.

Hi there to all of you GitHub experts, 

 

I am currently developing a pet project of my (a public website.)  The idea is basically to see what happens if total strangers from across the globe collaborate to create a website on a particular theme - my theme is gaming.

 

My hope is that together we can create something wonderful - each helping the other with languages/technologies that we are more familar with - but due to the open nature of my project, I need a versioning and colaboration system that is universal and doesn't rely on paid software or services.  Welcome git and GitHub!  Both are perfect for such a project as git is free and open source and cross plaform and GitHub provides free accounts, so even those who don't want or cant afford to pay can still take part.

 

The one expense for the project is a dedicated server - which I pay for anyway, so creating a webspace on my server and asigning a domain to it is no biggie to me and since it is my project, I am willing to aborb that cost.

 

So having explained what I intend on doing, now to the explaining of what I want to do - which brings me to my question.

 

Currently I have the following setup 

 

  • A local git repo connected to a remote public repo on GitHub
  • My remote repo is connected to my server, which is set to pull all changes from the remotes master branch and deploy them to the httpdocs folder on my server
  • I also have GitHub pages turned on with the master branch of the remote repo set as the source for GH-Pages

 

This is working fine, everything goes as you would expect except for one thing - I now have two identicle websites. One hosted on my server and one hosted on GitHub using GH-Pages.  This is not quite the set up I want!

 

What I want is a setup like this

 

  • local git repo connected to a remote GitHub repo
  • my server pulls all changes pushed/merged to the master branch from the remote and deploys them to the httpdocs folder

 

I also what this as well (on the same repo)

 

  • GitHub pages to be turned on
  • GH-Pages to use a folder/branch other than master as its source

 

So basically:  I will have a live website hosted on my server, the server will pull source files from the remotes master branch and deploy them to the httpdocs foder and I will also have a dev version of that same website hosted on GH-Pages that uses a dev branch/folder as its source.

 

That would mean:

 

  • I have a live production website
  • I have website showcasing the latest dev build 
  • All source files are publically availabe from one repo

 

I have been trying to figure out how to set this up to no avail.  Can any of you point me in the direction of some help articles or give me any instructions on how I can create the set up detailed above:  A dev site and a live production site, both from the same repo?

 

Cheers

jay

5 Replies
Community Manager
Message 2 of 6

Re: How do I have a live site and a dev site in a single repo

This post was moved to a different board that fits your topic of discussion a bit better. This means you’ll get better engagement on your post, and it keeps our Community organized so users can more easily find information. As you’ll notice, your Topic is now in the Pages board. No action is needed on your part; you can continue the conversation as normal here.

Highlighted
Pilot Lvl 1
Message 3 of 6

Re: How do I have a live site and a dev site in a single repo

Cheers @lee-dohm I should have realised that it was more a GH-Pages question.

Community Manager
Message 4 of 6

Re: How do I have a live site and a dev site in a single repo

You're welcome. We'll figure these things out together 😀

Solution
Pilot Lvl 1
Message 5 of 6

Re: How do I have a live site and a dev site in a single repo

Just a reply to my original question to say that I have actually worked out how to do this on my own by using the gh-pages branch.

 

Currently this is my setup now:

 

dev

This is my current working branch.  Other branches like comingsoon may be checkout from this branch, allowing me to work on small portions of problematic code or test new layouts, without effecting the rest of the content housed here.  Those branches are then merged back into the dev branch once issues have been closed.

gh-pages

This is now my testing branch.  gh-pages displays the very latest beta build of the site.  pages/links/content might be broken and not display properly.  This is where the public can test out the latest and greatest and submit issues/bug reports if they find them.

master

This is the defacto source for content that has been through dev and beta testing.  This branch is automatically deployed to my server everytime something is pushed to it

 

So now I have a continuous working branch dev and a beta testing branch to showcase and test my latest builds gh-pages and lastly a defacto branch master that is always up-to-date with my server.

 

Hopefully I have sorted this out now and my setup will work.  It seems to have been up till now though.

Ground Controller Lvl 1
Message 6 of 6

Re: How do I have a live site and a dev site in a single repo

How would you go to your dev site; what is the URL formation method?

 

https://username.github.io/dev/ 

 

If you use the github pages master for the front page of a website, how would you see the dev build at a different URL? Thanks ~