Installation/Working with git repositories

From OpenFOAMWiki
< Installation
Revision as of 13:34, 26 July 2015 by Wyldckat (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


1 Introduction

This page attempts to introduce the reader to getting familiar with how to handle git repositories that are related to OpenFOAM and building the source code provided by those repositories. This page does not attempt to:

  1. teach how to use git in detail, because there are a lot of tutorials and books available for that, which some are already listed in Tip Starting points for using GIT;
  2. teach you on how to use the shell/command line, because there is already a page that does that: Installation/Working with the Shell


The text may seem rather informal, so feel free to add to and improve this wiki page!

2 Installing Git

TODO


3 Cloning a repository

Usually this is pretty straight forward:

  1. Make sure you already have git installed, for example, by running:
    git --version

    If it's installed, it should state something like:

    git version 1.7.9.5

    Note: If it's not installed yet, then go back to the chapter Installing Git.

  2. Now find a good place (path) to clone the repository into, for example:
    • If it's OpenFOAM, then the usual path is ~/OpenFOAM. You can create the folder (if it doesn't exist yet) and go into it by running:
      cd ~
      mkdir OpenFOAM
      cd OpenFOAM
    • If it's foam-extend, then the usual path is ~/foam. You can create the folder (if it doesn't exist yet) and go into it by running:
      cd ~
      mkdir foam
      cd foam
    • If it's a community contribution repository (e.g. those listed at Contrib), then the advisable path is the dedicated user folder for the version of OpenFOAM technology you're using. You can create said folder (if it doesn't exist yet) and go into it by running:
      mkdir -p $FOAM_RUN
      cd $FOAM_RUN/..
  3. Next, it's just a matter of cloning the repository, for example:
    git clone http://github.com/OpenFOAM/OpenFOAM-2.4.x.git

    Or also include the target path where you want to clone into, for example:

    git clone git://git.code.sf.net/p/openfoam-extend/foam-extend-3.1 foam-extend-3.1
  4. If no error messages appear, then you're good to go! The next step is to go into the folder you've just finished cloning, for example:
    cd OpenFOAM-2.4.x

    Or:

    cd foam-extend-3.1


4 Pulling updates and updating the build

TODO