Skip to the content

Umbraco Source Control Using Umbraco Cloud and GitHub

Hi Peeps,

So I've finally got around to taking a look at Source Control for Umbraco and figured out what I believe are two suitable solutions. It was a bit of a learning curve and needed a fair bit of thinking and testing.

I hit a few road blocks along the way but nothing major. I thought I would document these problems here to help someone out who might be trying to figure out how to do the same.

So I've written two articles which are closely related....

1. This been the first and details Umbraco Source Control when using Umbraco Cloud & GitHub

This is the ideal solution if you're making use of Umbraco Cloud. This is the recommended way since Umbraco Cloud has really simplified media and content deployment.

2. The second which can be found here and details Umbraco Source Control using only GitHub

This method is suitable for anyone (like myself) choosing to host your Umbraco website outside of Umbraco Cloud on third party hosting or your own server. This method is slightly more difficult but I've documented this well to make it nice and easy for you.

Please Note...

Regardless of the which method is best for you I still recommend running through this tutorial first. There is some valuable information in here that will help you in both methods. It takes a few seconds to set up Umbraco Cloud, its very easy to use, and its free for trial purposes. You can create an Umbraco Cloud account here https://umbraco.com/campaigns/try-umbraco-today/.

Prerequisites

1. Signup and create a test site for Umbraco Cloud.

https://umbraco.com/campaigns/try-umbraco-today/

Tips: Once I was up and running with Umbraco Cloud I installed "The Starter Kit" so I had some real data to work with rather than a blank website.

2. Download and install Git locally.

https://git-scm.com/downloads

3. Create a GitHub account if you haven't got one already.

https://github.com/

4. Download and install GitKraken locally.

https://www.gitkraken.com/download

How To

I'm going to make this article short since Andrew Barta already did an awesome job on a series of Umbraco TV videos which will better document the steps involved. this article will just summarise on these steps and point out the issues I had along the way.

You can find all the required steps in the videos here. 
https://umbraco.tv/videos/umbraco-cloud/working-with-umbraco-cloud-and-visual-studio/recommended-approach/

If you prefer not to watch video tutorials the same information can be found here within Umbraco's documentation.
https://our.umbraco.com/documentation/Umbraco-Cloud/Set-Up/Working-With-Visual-Studio/ 

Step 1 - Setting up your Visual Studio solution & linking it to your Umbraco Cloud repository.

Umbraco has a preferred way of setting up the Visual Studio solution which works best when using Umbraco cloud. This is not set in stone and I personally do it a different way for my projects. I generally don't use Umbraco Cloud so this is the reason why I do it different. For the case of this tutorial and if you're using Umbraco Cloud then I suggest you setup your solution this way.

Umbraco have basically made this a piece of cake by setting up a bat / executable to set everything up for you. This can be found here.
https://umbra.co/uaas-cmd

Problems encountered:

When I ran through the script not all the solution files had been created as per Andrew's example. What I found was just one folder had been created that was named with a Guid. Inside was the Umbraco website files. There was no solution file or anything like that. To fix this I deleted everything and ran the script again and it worked. I tested this a number of times and it seemed quote temperamental. Sometimes it worked and sometimes it didn't. Just try a couple of times and I think you will be good.

Step 2 - Linking custom code to your own GitHub repository.

So Umbraco wants you to separate the source control off into two repositories. The first as described above is stored within Umbraco Cloud which they also use Git for. The second is any custom code is separated off into your own Git repository. This includes things like custom models, controllers, and other custom business.

Problems encountered:

So I encountered a couple of issues here which took me a while to figure out.

1. I cant remember the exact error message for the first issue but when I ran through the Git commands from Andrew

git remote add origin https://github.com/DavidArmitage/GitDemo.git

git push -u origin master

It bombed out with some sort of error message. I googled and it seemed that it was due to the remote version been later than that local (somehow). Anyway I tried starting from scratch a number of times. I tried re-installing git etc and still the exact same issue every time. I did some more digging around and instead of following the two command lines above I followed the ones from this URL and it worked a treat every time.

https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/

2. I also experienced the same issue Andrew was having in his example.

Fatal: the remote origin already exists

In-fact if you are testing like me and decide to create a few repositories you will encounter this issue a lot. Andrew's fix will save your life. Simply run it and try again.

git remote rm origin

Step 3 - Testing & Committing

So that's it. You should be good to go! 

----------------------

Remember if you are looking to host your website outside of Umbraco Cloud and want to know how to get up and running with source control please refer to my followup article here.

https://www.umbrajobs.com/blog/posts/2018/november/umbraco-source-control-using-github-and-usync/

----------------------

About the author

David Armitage

Umbraco Community Builder | .Net MVC Developer | Umbraco Certified Master | Recruitment Professional

Hey Peeps,

I'm an entrepreneur and web developer with a passion for coding. I absolutely love working with Umbraco CMS and appreciate the Umbraco community even more.

I've got 10 years+ .Net experience and 7 years+ experience working in the recruitment industry, both coding and marketing job websites. I wanted to use my skills to help give something back to this awesome community and so I decided to build UmbraJobs.com.

My vision & fundamentals

I want this website to be a place where Umbraco Professionals and Umbraco Partners can advertise their services but at the same time I want to filter out all the under-qualified freelancers & agencies that take up the biggest part of other job & freelancer websites. We've all worked hard to gain our Umbraco certifications, partnership status, and help build the Umbraco community to what it is today. I want to see everyone get rewarded for their efforts.

Follow me on social media

If you're an Umbraco professional, partner, employer, recruiter or a passionate Umbraco community builder then I'm more than happy to hear from you. Follow me on my social media channels and please reach out if you have any needs, want help or consultation with anything Umbraco related or just want a general chat.

comments powered by Disqus

Blog Filter


How we can help?

Need help with an Umbraco project?

Need help with a project but not too sure who to approach? Send us your project brief and budget. We will provide a free consultation and can help you gather quotes from the best and most suitable freelancers or agencies.

Looking to hire an Umbraco Professional?

Have you got job vacancy and want to hire an Umbraco professional? Post a job on our website for free. Alternatively let us know your requirements and we will send suitable prospects your way.

Claim your free profile!

Are you an Umbraco Freelance Developer or Umbraco partner that wants to advertise on our site? If you work with Umbraco or registered as an Umbraco partner then you can create a profile for free.

Let's build the Umbraco Community

We're big on building the Umbraco community and we think you guys are awesome! If there's anyway at all we can help then please reach out.