This page last changed on Jan 13, 2009 by stepheneb.

Forking otrunk-examples with git and using the fork for testing

The whole otrunk-examples svn tree is mirrored to a public git repository hosted at Github|].

ref: original email thread

You can easily host your own git of otrunk-examples with any new files or changes to existing files on github. When you do this not only is it a public git clone but all the content is web accessible which means you can use it as sources for new activities, reports, or report templates in a DIY instance.

In addition if you make changes which should be integrated back into otrunk-examples proper having working examples in a public git clone makes this operation very easy.

The current version of these instructions assume you have a Mac OS X system and you are using Github. With a few changes in the details all of this can also be done on Windows and Linux and also using other public git hosting sites (examples: and Gitorious).

Useful background information

Instructions (using the C version of git and a command line shell)

  1. Install git using macports:
  2. Get a copy of gitx (macos app for visualizing a local git repository:
  3. Register for an free account on github, login, and follow the Setting Up instructions here:
    Specifically make sure you upload a copy of the public version of your ssh key.
    I'll assume your github username in the instructions below is newgithubuser.
  4. Browse to the public otrunk-examples clone and click "fork"
  5. In a shell on your local computer clone your fork of otrunk-examples and cd into the directory:
    git clone
    cd otrunk-examples

    You now have a clone of your fork of otrunk-examples in the local directory otrunk-eamples/.git. In addition the clone command checked out a copy of the master branch in this repository in your github fork to the local dir otrunk-examples/. If you list the dir ls otrunk-examples you will see all the files and directories in otrunk-examples.
    In addition you have created one remote reference in your local git repository for otrunk-examples named origin.

    $ git remote -v show
  6. Add a second remote reference to the CC official public git clone of otrunk-examples and fetch a copy into your git repository.
    git remote add cc-otrunk-examples git://
    git fetch cc-otrunk-examples

    This will allow you to also keep track of changes made at CC.
    Using git fetch just copies the data into your local repository, otrunk-examples/.git, but does not check out a branch into your working directory otrunk-examples/.
    The git fetch did create an additional remote reference. Listing remotes will show you the protocols and paths for each remote repository and the names you can use to refer to them:

    $ git remote -v show
    cc-otrunk-examples	git://

    The origin repository is your fork and because you can write to it you use an ssh form of connection The cc-otrunk-examples repository uses an anonymous protocol which means you can only read from git://

  7. Create a local branch named ccmaster and checkout the master branch from your local copy of the CC otrunk-examples repository into it:
    git checkout cc-otrunk-examples/master -b ccmaster
  8. Switch back to your "master" branch and merge into your master branch any new changes from ccmaster:
    git checkout master
    git merge ccmaster
  9. Make some new files in your master branch by copying existing files already in otrunk-examples:
    cp LOOPS/hanging-with-friends-1-mw-jruby.otml LOOPS/hanging-with-friends-2-mw-jruby.otml
    cp LOOPS/scripts/hanging-with-friends1-logging-mw.rb LOOPS/scripts/hanging-with-friends2-logging-mw.rb

    To make this work for this example change hanging-with-friends-2-mw-jruby.otml so it references the new script file hanging-with-friends2-logging-mw.rb.

  10. Commit these files to your master branch in your local git repository:
    git commit -a
  11. Push your local master branch to the master branch in your public github repository:
    git push origin master
  12. Create a new External OTrunk Activity in a DIY instance and set the External otml url to:

    Note: If you had created a second branch on github named "experimental" and pushed additional changes to hanging-with-friends-2-mw-jruby.otml there you can access the raw form of that document using this url:

    The general form for getting http access to a raw presentation of the resources in a repository branch hosted at github:<github-user>/<repository-name>/raw/<branch-name>/<path-t0-resource>

The development DIY at is a good place to conduct experiments. Register at the DIY and send an email to the otrunk-dev list requesting a developer role. Take a look at this activity in the dev DIY: Hanging with Friends (mw-jruby) (from github clone) for an example. In this case it is running from the CC public git clone of otrunk-examples so it operates just like the original otml activity would but it demonstrates the form of the url to access the raw otml resources in the master branch and running the activity confirms that it all still works.

Document generated by Confluence on Jan 27, 2014 16:52