Skip to content

zArchive_GitObtaining

Lori A. Burns edited this page Jun 3, 2015 · 1 revision

Dummy

Obtaining PSI4 from Sirius

The first thing you need to access the source code is to have your ssh public RSA key known to the source code server. Look for the file $HOME/.ssh/id_rsa.pub (or id_dsa.pub) and send it to Daniel Crawford. He can then add this info to the server. If you don't have this file, run ssh-keygen and accept the defaults to create the needed file.

The PSI4 source is now managed by the git distributed version control system.

To checkout a working copy of the master branch into a new directory named psi4:

git clone git@sirius.chem.vt.edu:psi4

To checkout a working copy into a different directory:

git clone git@sirius.chem.vt.edu:psi4 name_of_new_directory

To update your current copy to include the latest revisions:

git pull origin master

In this command origin is a remote identifier that refers to where the repository came from, in this case sirius. master refers to the branch from sirius you want to pull from. Issuing a git pull command will fetch and merge the requested branch into your current branch.

Obtaining Psi4 from Github

Psi4 is hosted as a private repository on GitHub. Therefore the first step to accessing the code is to create a GitHub account and to ask one of the primary developers to add you as a collaborator. (If you've committed substantially to Psi4 already, make sure the e-mail address with which you committed to sirius is associated (needn't be primary) with your GitHub account.)

Before you can check out a copy of PSI from Github, you must ensure that your SSH key from the machine you wish to check out PSI to has been registered with your account on Github. Go to account settings, select SSH keys, and paste the SSH key (from .ssh/id_rsa.pub) from the machine you're using.

To check out a fresh working copy of the repository (if you get a 401 error, check your git --version. It needs to be at least 1.7.10)(to avoid retyping your password, follow the instructions on password caching at https://help.github.com/articles/set-up-git):

git clone git@github.com:psi4/psi4.git

To enable an existing psi4 repository to work with both sirius and github:

  • check that the existing remote, origin, points to sirius

    >>> git remote -v
    origin      git@sirius.chem.vt.edu:psi4 (fetch)
    origin      git@sirius.chem.vt.edu:psi4 (push)
    
  • add a new remote for github, tagged gh

    >>> git remote add gh git@github.com:psi4/psi4
    >>> git remote -v
    gh  git@github.com/psi4/psi4 (fetch)
    gh  git@github.com/psi4/psi4 (push)
    origin      git@sirius.chem.vt.edu:psi4 (fetch)
    origin      git@sirius.chem.vt.edu:psi4 (push)
    
  • now the repository can interact with sirius and github through (substitute branch if not on master)

    >>> git pull origin master
    >>> git push origin master
    >>> git pull gh master
    >>> git push gh master
    

Warning

sirius and github are not rigorously synched at present

If during the first clone or pull operation, you get

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

you will need to generate and/or add a public key to github. See the following for details: https://help.github.com/articles/generating-ssh-keys

Switching origin to GitHub

The previous section details how your working psi4 repository can interact with both sirius and github, where the former is the default for git pull/push. This section shows how to switch that arrangement so the same repository uses the latter as default for git pull/push.

  • First remove the current remotes

    >>> git remote -v
    gh   git@github.com/psi4/psi4 (fetch)
    gh   git@github.com/psi4/psi4 (push)
    origin       git@sirius.chem.vt.edu:psi4 (fetch)
    origin       git@sirius.chem.vt.edu:psi4 (push)
    >>> git remote rm gh
    >>> git remote rm origin
    
  • Add GitHub remote as origin

    >>> git remote add origin    git@github.com:psi4/psi4
    >>> git config master.remote origin
    >>> git config master.merge refs/heads/master
    
  • Reattach to sirius remote

    >>> git remote add sirius git@sirius.chem.vt.edu:psi4
    >>> git remote -v
    origin       git@github.com/psi4/psi4 (fetch)
    origin       git@github.com/psi4/psi4 (push)
    sirius       git@sirius.chem.vt.edu:psi4 (fetch)
    sirius       git@sirius.chem.vt.edu:psi4 (push)