Basic Git
This tutorial demonstrates how to setup and use git in a solo environment. Unlike other tutorials, we ignore the ability of git to collaborate with others and instead use it to backup (with history) and maintain syncornized directories between multiple computers. Hence, one can be working on research equally well between each of their different machines.
In this tutorial we will assume the user has two Linux machines: laptop and caampc. Both have git already installed (this is not the case on all CAAM machines; ask Eric Aune for help). The computer caampc is always online and can be reached through SSH. We will place the central repository on caampc and then access this repository from laptop.
Git Setup
To keep track of who is making commits and on what machine, we tell git
to store information about us applicable to all repositories on the local machine.
Git wants to know a name and email address, but rather than a true email address,
some prefer to use the "user@domain" convention to specify which machine we are on.
So, for example, on caampc,
Setup the Repositories
Starting on caampc, we setup an empty git repository that will serve as the HEAD repository. This should be placed in the "scratch" area available on the local disk (rather than on the network mounted home directory). In our example, we will call the new repository "eigen." First we create the directory for the repository
Now we are ready to add our first file. While still in the directory eigen,
Now we have our first repository with our first commit. Git is perfectly happy to keep a version controlled directory all on its own, but our objective is to have a repository accessible from multiple machines. In this configuration, our current directory (/scratch/git/eigen) will serve as the "HEAD" to which all commits are made. Consequently, we should no longer edit files in this directory. We now tell git that this directory is going to be a "bare" repository
Using the repository
The git life cycle is different from SVN's in that commits are local edits to the repository. To commit these the "HEAD" repository, we use the push command and to obtain the most recent version, we use pull. For example, let's edit the read me file:
Further information
For futher information about git, I would recommend
