Installation/Working with git repositories
From OpenFOAMWiki
Contents
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:
- 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;
- 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
The official instructions are provided here: Getting Started - Installing Git
But usually it's just a matter of installing it in your system:
- Linux
- As root (see What is root mode?), run:
- On Debian systems (e.g. Ubuntu and Linux Mint):
apt-get install git-core
- On Redhat systems (e.g. Fedora, RHEL, CentOS, SL):
yum groupinstall "Development Tools"
Or:yum install git
- On Suse systems (e.g. OpenSUSE):
zypper install git
- On Debian systems (e.g. Ubuntu and Linux Mint):
- Mac OS X
- The official version for Mac OS X: Git for Mac OS X at git-scm.com
- Windows
- The official version for Windows: Git for Windows at git-scm.com
- msysGit: msysGit at msysgit.github.io
3 Cloning a repository
Usually this is pretty straight forward:
- 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.
- 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/..
- 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:
- 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
- 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