Cloud Management: Version Control

This article describes how to use integrate version control systems with the Moovweb SDK. (If you are still using Moovweb SDK 4.7 or earlier, please see the deprecated git push instructions below for deployment.)



When using Git with the Moovweb SDK, the best way to stay synchronized with the Moovweb Cloud is to write a deploy script that sets your -deploy-id equal to the hash of the current commit you’re on.

This deploy script could be something as simple as:

moov deploy -deploy-id=`git rev-parse HEAD` <myAccount>/<myProject>

Or it could be a more complex script taking a variety of other factors into account.

Git (Moovweb 4.7 and earlier)

In Moovweb 4.7 and earlier, Moovweb used Git pushes to deploy code to the Moovweb Cloud. This will still work for users with older versions of the Moovweb SDK, but if you are using Moovweb 5 or later, you should use the Moov Deploy instructions at the top of this page.

Moovweb still recommends using Git or any preferred version control system to manage your project code, but pushing with Git is no longer necessary for deployment. Git is a distributed version control system similar to Subversion (SVN) or Mercurial. You will have already downloaded and installed the latest version of Git as part of the download process. You can also configure your Git settings.

Get familiar with the basic Git commands at For more detailed explanations, check out their online book.

Verify your Git installation and configuration from the terminal:

git config -l

This will display your username, email, and any other settings you’ve configured.

Using GitHub (Moovweb 4.7 and earlier)

There are many Git code hosting services such as GitHub and BitBucket. This section describes using GitHub, other code hosting services work very similarly.

Once you have generated a Moovweb project you can create a new Git code repository on GitHub. Add this code repo as another Git remote on your Moovweb project:

git remote add github<github_account_name>/<project_name>.git

You can also connect your Moovweb project to the GitHub repo via the settings page of your project:

Adding a GitHub repo

Once added, Git commits on the project page will link to the corresponding commit in GitHub.

You should periodically commit and push your work to GitHub in order that your code is stored. You can also use GitHub to collaborate with other developers, review commit messages and track issues.

Then, to push your work to GitHub you would run:

git push github master

Adding a Moovweb Remote (Moovweb 4.7 and earlier)

If you have an existing GitHub repo with your code, and you are using the Moovweb SDK version 4.7 or earlier, you can also easily add a new Moovweb remote repo, like so:

git remote add moovweb<moovweb_account_name>/<project_name>.git

And to push changes to this new Moovweb remote, run:

git push moovweb master

You will automatically trigger the build process. Keep in mind that if you are using Moovweb SDK version 5 or later, you should use the moov deploy command instead of pushing with Git.

If you have Git submodules in your project, the build will fail. Please see our article on Submodules and Subtrees for more information.

Production and Staging with Git (Moovweb 4.7 and earlier)

For most production websites, you would have one code repository called origin and two Moovweb projects — staging and production.

You should have all these three (origin, staging, and production) as remotes to your local Git repo. Typically, origin will be your GitHub repo, the staging project will point to a hidden staging domain, while the production project will have the live domain

Moovweb Workflow

Here’s an example setup:

git remote -v

origin (fetch)
origin (push)
staging (fetch)
staging (push)
production (fetch)
production (push)

Your deployment workflow can then be set up as:

  1. Push to your code repo on GitHub several times a day
  2. When you’re ready to go live, add a Git tag to your code repo
  3. Now, push to staging first and ensure a successful build
  4. Once the stage project has been built, QA on the staging site
  5. Once QA on stage is complete, you are sure the site is ready
  6. You can can then push to production