Using Git

Git is an open-source version control system primarily used for software development. It has many appealing features, including seamless branching and merging, fast performance, and easy-to-learn workflows.

Using Git on CARC systems

Begin by logging in to CARC sytems. You can find instructions for this in the Getting Started with Discovery or Getting Started with Endeavour user guides.

To use Git, load a corresponding software module. For example:

module load gcc/11.3.0 git/2.36.1

Now the git command is available and you can create and interact with Git repositories.

Note: If you require a different version of Git that is not currently installed, please submit a help ticket and we will install it for you.

SSH configuration for hosted Git services

To interact with a hosted Git service such as GitHub, GitLab, or Bitbucket, you will need to modify your SSH configuration.

First, create a new SSH key if you have not already done so:

ssh-keygen -t ed25519

Then, add the SSH key to the hosted Git service that you want to use by copying the contents of the newly created SSH public key (e.g., ~/.ssh/id_ed25519.pub) and pasting it into the corresponding SSH key field. The specific steps for this differ for each Git service. See the following guides:

Next, edit the ~/.ssh/config file to include the following lines, substituting ~/.ssh/id_ed25519 for your unique key:

Host github.com
    IdentityFile ~/.ssh/id_ed25519

Change the hostname as needed to your preferred Git service. You should then be able to interact with the hosted Git service for tasks such as cloning Git repos and pushing and pulling changes to your code. For these Git commands and many more, refer to the additonal resources below.

Additional resources

If you have questions about or need help with Git, please submit a help ticket and we will assist you.

Git
Git cheatsheet

Tutorials:

Git tutorial
GitHub tutorials
GitLab tutorials
Bitbucket tutorials

Web books:

Pro Git

Back to top