Difference between revisions of "Git instructions"

From Gw-qcd-wiki
Jump to: navigation, search
Line 23: Line 23:
 
# open gitosis.conf with your favorite editor and add the following three lines <br><br> [repo ''repository_name''] <br> description = ''repository description'' <br> owner = ''owners_name'' <br><br> You can use the repositories already listed in gitosis.conf as a an example.  
 
# open gitosis.conf with your favorite editor and add the following three lines <br><br> [repo ''repository_name''] <br> description = ''repository description'' <br> owner = ''owners_name'' <br><br> 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: <br> <tt> git commit -a  <br> git push </tt>
 
# After adding the three lines commit and push the changes using: <br> <tt> git commit -a  <br> git push </tt>
# 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 <tt> <br> git init </tt> <br> 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) <tt> <br>git add . </tt> Then commit the changes using <tt> <br> git commit -a </tt>
+
# 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 <tt> <br> git init </tt> <br> 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) <tt> <br>git add . </tt> <br> Then commit the changes using <tt> <br> git commit -a </tt>
 
# Next add the URL for Samurai by executing <tt> <br> git remote add origin gitosis@samurai.phys.gwu.edu:''repo_name.git'' </tt>
 
# Next add the URL for Samurai by executing <tt> <br> git remote add origin gitosis@samurai.phys.gwu.edu:''repo_name.git'' </tt>
 
# Then push your changes using <tt> <br> git push origin master </tt>
 
# Then push your changes using <tt> <br> git push origin master </tt>

Revision as of 20:49, 29 August 2010

Obtaining and Installing Git

  1. Go to http://git-scm.com/ and download the most recent tar ball.
  2. untar the tarball and cd into the git directory
  3. Set the install directory by running:
    ./configure --prefix=install_directory
  4. run the command:
    make -j && make -j install
  5. 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

  1. Andrei Alexandrou aalexan@gwu.edu
  2. 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

  1. gwu-qcd This repository contains the current suite of programs available to perform lattice QCD calculations.
  2. thrust This repository contains the git thrust mirror. Thrust is an efficient c++ library which is used for example by gwu-qcd.
  3. 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.

  1. Start by entering the gitosis_admin directory and pulling the latest copy using
    git pull
  2. 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.
  3. After adding the three lines commit and push the changes using:
    git commit -a
    git push
  4. 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
  5. Next add the URL for Samurai by executing
    git remote add origin gitosis@samurai.phys.gwu.edu:repo_name.git
  6. Then push your changes using
    git push origin master
  7. 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

  1. gittutorial(7) can also be found online, http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html
  2. http://www.kernel.org/pub/software/scm/git/docs/everyday.html
  3. http://git-scm.com/documentation