Building Git repositories containing sub modules with Continua CI

Today I wanted to add a repository to the build server that contains submodules. The submodules are required because I prefer to share code via shared projects so they will always be compiled for the right platform as you can read here.

When you add a repository to a project or configuration in Continua CI, you can add authentication. However, the sub modules won’t use the same authentication which means that the submodule can never be retrieved. To solve this issue, use the steps below.

Create separate build server account (optional)

I prefer to create a read-only account for build servers so it can never screw anything up. For private projects I use Bitbucket so I created a new buildserver account and added it to the team with read-only access.

Create _netrc file on the server

The _netrc file can be used to provide default credentials to a server when they aren’t provided on the actual repository. I prefer to keep everything together so I followed the following steps:

  1. Create directory C:\Continua\Auth
  2. Create a %HOME% system variable pointing to this path (I prefer using a shared path for %HOME% so it is accessible to all users)
  3. Create the _netrc file (note that there is no extension) with the following content:

machine [host]
login [buildserveraccount]
password [password]

for example:

machine bitbucket.org
login mybuildserveraccount
password mypassword

Now Continua CI will be able to pull the submodules as well.