Setting Up Git Software Tool on Linux

Learn how to set up the Git software tool on Linux for use with the Eagle system.

To set up git on Linux, you have to do a little bit of command-line configuration.

We will assume the sysadmin has git already installed on the system. Before you can get started using the github.nrel.gov git repos, you'll have to do some basic setup. This includes:

  • Basic git configuration
  • Setting up secure shell (SSH) keys.

Basic Git Configuration Set Up

Git needs to know your user name and an email address at a minimum:

$ git config --global user.name "Your name"
$ git config --global user.email "your.name@nrel.gov"

Set Up Secure Shell Keys

If you are trying to use git on one of the HPC systems, such as Eagle, you already have SSH keys created on those systems. If this is the case, for more information, see using the git tool.

You probably have SSH keys set up on your Linux, HPC, or Apple OS X system (MacBook Pro) already, but if not, follow these steps to setup your SSH keys.

Have an existing key pair? You can skip to Step 4.

First, we need to check for existing ssh keys on your computer:

$ cd ~/.ssh

...checks to see if there is a directory named `.ssh` in your home directory. If it says "No such file or directory" skip to step 3. Otherwise continue to step 2.

Since there is already a ~/.ssh directory you'll want to back it up just in case:

$ ls
config  id_rsa  id_rsa.pub     known_hosts 
$ mkdir key_backup
$ cp id_r* key_backup

Note: DO NOT do this on the HPC systems, such as Eagle. Eagle already has keys generated.

To generate a new SSH key, enter the code below. We want the default settings. So when asked to enter a file in which to save the key, just press enter.

$ ssh-keygen -t rsa

Passphrases... In this case, please just hit return. Yes, it's more secure to enter a passphrase.

Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):<enter a passphrase> Enter same passphrase again:<enter passphrase again>

Which should give you something like this:

Your identification has been saved in id_rsa.
Your public key has been saved in id_rsa.pub.
The key fingerprint is: 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db USER@HOSTNAME The key's randomart image is: +--[ RSA 2048]----+ | | | | | | | o o | | + = S . o | | o o + . . + o | | . o o ..= | | o E +o..| | . ..oB= | +-----------------+

Next Steps - Using a Remote Git Repository

Now you have all the basic configuration for using git with a remote repository ready. Your next steps will be to get access to a git repository, clone the repo, and learn how to add code and commit changes to your repo.

For more information, see using the git tool.


Share