Git instructions
Contents
Obtaining and Installing Git
- Go to http://git-scm.com/ and download the most recent tar ball.
- untar the tarball and cd into the git directory
- Set the install directory by running:
./configure --prefix=install_directory - run the command:
make -j && make -j install - add (if necessary) install_directory/bin to $PATH and refresh your shell and your done.
Checking Out a Repository
In order to checkout a repository you have to first be granted access. You can ask for access by contacting an administrator. If granted access you will have to present an ssh public key as well as setup an account on Samurai where the git repositories are hosted. Current administrators are
- Andrei Alexandrou aalexan@gwu.edu
- Craig Pelissier craigp@gwmail.gwu.edu
Once you have access you can pull a repository using
git clone gitosis@samurai.phys.gwu.edu:repos_name
In the last step you will be prompted for your password on Samurai unless you have added the local host's pub key to your authorized keys on Samurai. The current repositories available are
- gwu-qcd This repository contains the current suite of programs available to perform lattice QCD calculations.
- thrust This repository contains the git thrust mirror. Thrust is an efficient c++ library which is used for example by gwu-qcd.
- mem-prof This contains a memory profiler program that allows one to determine how much memory (cpu and gpu) is being used by a program.
Adding a Repository
The following describes how to add a git repository. You must have write access to the gitosis-admin directory in order to add repositories.
- Start by entering the gitosis_admin directory and pulling the latest copy using
git pull - open gitosis.conf with your favorite editor and add the following three lines
[repo repository_name]
description = repository description
owner = owners_name
You can use the repositories already listed in gitosis.conf as a an example. - After adding the three lines commit and push the changes using:
git commit -a
git push - Next we have to push the repository to the host i.e. gitosis. To do this first initialize your working directory (the directory you want to add as a repository) by executing the command
git init
Then add all the files in the directory by using (if you don't want to add all files then just use git add to add the files you want)
git add .
Then commit the changes using
git commit -a - Next add the URL for Samurai by executing
git remote add origin gitosis@samurai.phys.gwu.edu:repo_name.git - Then push your changes using
git push origin master - At this point you haven't given anyone the ability to pull this repository and mostly likely you want to. If you want to give all qcd users the ability to pull simply add the name of your repo to the list of repos that are writable for the qcd group. You can do this by updating the gitosis.conf file. For example
[group qcd]
writable = repo_name1 repo_name2
memebers = key1 key2 .. etc
If you want to define a new group of users that can access the repos then add a new group by adding the three lines
[group group_name]
writable = my_repos_name
members = member keys
Note: see the section on adding keys to add member keys properly.
Adding Keys to gitosis.conf
FAQ by Administrators
How do I fix gitosis.conf if I accidentally pushed an update that contains a typo?
Unfortunately pushing a change to gitosis.conf renders you unable to push a fix as well as pull. To fix this you have to edit the file manually as the git user on Samurai. To do this you need to edit the gitosis.conf file owned by the git user. It is locate on samurai at
/srv/gitosis/gitosis-admin
simply fix your typo and save the changes.
FAQ by Users
Git Tutorials
- gittutorial(7) can also be found online, http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html
- http://www.kernel.org/pub/software/scm/git/docs/everyday.html
- http://git-scm.com/documentation