Creating a Code+Content version of TeamMentor

The current TeamMentor code/deployment set-up is based on the concept that Code (the app) and Content (the libraries) should be separated (with everything hosted on GitHub) 

In practice this means that we will need 3 GitHub repositories: one for the Code; one for Content; and one for Code + Content.

Most operations in this workflow are normal GitHub actions, except the clone of the Content into a special folder which needs to be done using an git SubTree merge (see here and here for more details on subtree merging)

The rest of this post documents a a step-by step example on how to build such Code + Content repository:

Repositories used:

step1: create a local repository

a) create the target folder in the local file system, in this case: E:\TeamMentor\_TM_QA_Deploy\TM_3.2_with_OWASP_Library
b) open git bash (you need to have Git installed on that VM), and cd into that folder using

 $ cd E:\\TeamMentor\\_TM_QA_Deploy\\TM_3.2_with_OWASP_Library

c) create an local repository via

  $ git init

step 2: step up the remotes

a) run:

$ git remote add tm_master
$ git remote add tm_library

b) at this stage the command

$ git remote -v

should return

   tm_library (fetch)
   tm_library (push)
   tm_master (fetch)
   tm_master (push)

step 3: get the code (via normal pull)

a) run:

$ git pull tm_master master

b) check that the code is now on the target folder (…./TM_3.2_with_OWASP_Library ), and that there is no libraries in …/TM_3.2_with_OWASP_Library\Library_Data\XmlDatabase

step 4: get the content (via a git subtree merge)

a) run these commands in sequence:

$ git fetch tm_library
$ git merge -s ours –no-commit tm_library/master
$ git read-tree –prefix=Library_Data/XmlDatabase/TM_Libraries/ -u tm_library/master
$ git commit -m ‘adding Library files’

b) if you look now at the …/TM_3.2_with_OWASP_Library\Library_Data\XmlDatabase folder there should be an OWASP library in there

step5: to publish new repository to github (

a) run:

$ git remote add origin
$ git push -u origin master

b) if you browse to the target repository (in this case you will now see an updated repository with both code and content

c) the best part of this solution, is that the git history was preserved:

NOTE: to get updates from the source repositories (pull)

$ git pull tm_master master
$ git pull -s subtree tm_library master

It is important to use the -s subtree option when updating the content, or you will get a normal pull which will put the content files in the root directory of this repository (which is not where they are supposed to be)


About Dinis Cruz

Dinis Cruz is the main developer of the OWASP O2 Platform and TeamMentor
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s