Hosting on github

To be able to commit changes to a github hosted repository, now github requires you to use ssh to checkout and push changes. To do this you need to generate an ssh key and publish it on the github web page. github doesn't allow you to register the same ssh key for multiple repositories, so if you have multiple repositories you wish to contribute to from the same host computer there needs to be a little bit of ssh voodoo. The following assumes the use of OpenSSH on either unix or windows. For Windows, you can install the OpenSSH client from the app menu in Settings. Also for Windows, you need to have the "OpenSSH Authentication Agent" running (run from Services app).


  • Generate a unique ssh key for each repository using ssh-keygen command line tool
    • For Windows, also use ssh-add command line tool to add private keys to ssh agent

  • Add public keys to each repository on github from settings tab

  • Generate a config file in your ssh directory (e.g. ~username/.ssh/config) with an entry for each repository and matching ssh key, e.g.:


.ssh/config
Host github.com:slaclab/Lucretia.git
        Hostname github.com
        IdentityFile ~/.ssh/id_lucretia

Host github.com:slaclab/facet2-lattice.git
        Hostname github.com
        IdentityFile ~/.ssh/id_facet2-lattice

now you can clone with git clone git@github.com:slaclab/facet2-lattice.git etc and successfully perform push/pull operations and so on.

Updating AFS repo

The controls network machines (e.g. facet-srv01) cannot see the outside world, so another version of the repo has to be hosted on SLAC AFS.

The Lucretia repo is here:

.ssh/config
/afs/slac/g/cd/swe/git/repos/slac/FACET/Lucretia.git

and the FACET-II lattice repo is here:

.ssh/config
/afs/slac/g/cd/swe/git/repos/slac/FACET/facet2-lattice.git

To synchronize the AFS repo with the github repo, do the following:

.ssh/config
$git remote add lucretia_afs git@/afs/slac/g/cd/swe/git/repos/slac/FACET/Lucretia.git

$git remote -v

origin	/afs/slac/g/cd/swe/git/repos/slac/FACET/Lucretia.git/ (fetch)
origin	/afs/slac/g/cd/swe/git/repos/slac/FACET/Lucretia.git/ (push)

and then push your changes.

You will have to toggle the remote repos to keep both github and AFS synched, but this shouldn't need to happen too often for Lucretia and facet2-lattice.

Cron job for synchronizing MatlabTNG

The MatlabTNG directory in updated frequently on the controls network, with the master repo on AFS. The github repo is synched to the AFS repo with a cron job.

.ssh/config
Fill in details here
  • No labels