Search Docs by Keyword

Table of Contents

Git and Github on the FASRC cluster

We strongly encourage all persons writing code (C, C++, Fortran, R, etc) to make use of the version control system git. The git suite of tools is available on the cluster without having to do a module load, and is available on all login and compute nodes.

FASSE or Cannon

On FASSE, you cannot use SSH protocol. Therefore, you must use HTTPS protocol.

Public repo

For a public repo, you can simply clone without authentication:

git clone https://github.com/fasrc/User_Codes.git

However, you can only push after authenticating (see private repo).

Private repo

  1. Create a fine-grained personal access token (PAT). If the repository you are cloning does not allow fine-grained, then create a classic token. Make sure you give the appropriate permissions for the token such that you may clone and push changes.
  2. Ensure your repository on Cannon or FASSE is located in a secure location, e.g. your home directory. Otherwise whoever has access to the directory can see your private access token
  3. Clone the repository. This is the general syntax:
    git clone https://<username>:<github_pat_token>@github.com/<organization>/<repo>.gitFor the FASRC User_Codes Github repository and jharvard user, this becomes:
    git clone https://jharvard:<githut_pat_token>@github.com/fasrc/User_Codes.git
    And jharvard needs to substitute <github_pat_token> with their PAT token that was generated in #1.

If you have cloned a repository but is unable to push, follow steps 1 and 2 above. Since you have already cloned a repository, an origin remote will already exist. You can either

  1. Add a remote called something else (i.e., something different than origin)git remote add <my-remote> https://<github_pat_token>:<org>/<repo>.git.As an example, the FASRC User_Codes Github repository with jharvard user, this becomes:
    git remote add new_origin https://<github_pat_token>:@github.com/fasrc/User_Codes.git
  2. Or update the origin remote to point to the repo with PAT in the URL; e.g.
    git remote set-url origin https://<github_pat_token>:<org>/<repo>.gitFor the same example:
    git remote set-url origin https://<github_pat_token>@github.com/fasrc/User_Codes.git

FASSE proxy

If you are having problems reaching Github, Gitlab, or another external repository, you need to set FASSE proxy.

Cannon only

If you cloning Github repos using the HTTPS protocol, for example

git clone https://github.com/fasrc/User_Codes.git

You may experience authorization issues that you may not have experienced on your desktop or laptop. Instead, you can use the SSH protocol, in conjunction with a personal, cluster public SSH key that needs to be included in your Github account preferences. For example:

git clone git@github.com:fasrc/User_Codes.git

Please follow the instructions at https://help.github.com/articles/generating-ssh-keys/ to generate your key on the FASRC cluster. Briefly

  1. Log into the cluster.
  2. Generate your SSH key according to Github’s directions. There is no need to follow step 3 (Add your key to the ssh-agent).

If you now clone a Github repo on the cluster with the SSH protocol, you should be good to go.
For Existing Repositories: If you’ve already cloned a Github repo using http:// or https://, you can switch to SSH with these simple directions:

  1. In the terminal and on the cluster, ensure you are inside the top level or one of the directories of your repository.
  2. On Github, navigate to the repository you had cloned, switch to the SSH protocol, and copy the link. The protocol should look something like git@github.com....
  3. Issue the command git remote set-url origin URL, where URL is the link you copied in the previous step (e.g. git@github.com....).
  4. Use the command git remote -v to see if there are other remote repository URLs that you need to set.

You should now be able to issue the git push command without error.

© The President and Fellows of Harvard College
Except where otherwise noted, this content is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license.