Project

General

Profile

Working with github

This article contains some useful information and commands about how to interact with source code repositories (including larsoft) that are hosted on github. For additional information refer to official larsoft github instructions at the link below.

Initialization

Issue the following commands (do this once per home area). This is necessary before you can use the "hub" command.

    git config --global user.name "<First Name> <Last Name>" 
    git config --global user.email <Your-Email-Address>
    git config --global user.github <Your-GitHub-Account-Username>

These commands will create or update a file .gitconfig file in your home directory. Refer to larsoft documentation for instructions about how to register an ssh key that will allow you to push to github without typing your github password.

Checking out source code using mrb

Check out from larsoft github repository

The local checked out repository will have a remote origin that points to the the official larsoft github repository. You won't be able to push to origin.

$ mrb g [-b branch] [-t tag] larreco

Check out from uboone organization github repository

The local checked out repository will have a remote origin that points to the the uboone fork. You will be able to push to origin if you are a member of the uboone organization. Any MicroBooNE collaborator can be added to the uboone organization on request.

$ mrb g -g uboone [-b branch] [-t tag] larreco

Check out from your personal fork

The local checked out repository will have a remote origin that points to your personal fork.

$ mrb g -g <username> [-b branch] [-t tag] larreco

Working with multiple remotes

List currently defined remotes

$ git remote -v

Manually add a remote.

git remote add uboone git@github.com:uboone/larreco.git
git remote add larsoft git@github.com:LArSoft/larreco.git
git remote add mine git@github.com:<username>/larreco.git

Create a fork using hub

Create a fork in your personal github account, and add a remote pointing to the fork.

hub fork --remote-name=origin

If the named remote already exists, it is renamed to "upstream." If option --remote-name is omitted, this command add a remote with your github username.

Create a fork in the uboone organization github account, and add a remote pointing to the fork.

hub fork --remote-name=origin --org uboone