Getting Started with GIT

Reviewed by bil hays, 2017-02-27

You will need to make a public/private key pair for access to the cs git repositories. If you have a public/private keypair already, send the public key (not the private key) and we’ll get you set up.

Use a SSH to login to the linux server. You’ll want to make a directory that only you can access in your afs home directory. AFS has to be able to read your .ssh folder so you don’t want to use that for private keys:

mkdir .ssh-private
fs sa .ssh-private system:administrators none
fs sa .ssh-private system:anyuser none

then run
fs la  .ssh-private

And see that only you have permissions to use that directory. This is not an issue on your personal machines, on OS X boxen, or on windows machines, since we don’t use AFS home directories on these systems, but you need to do this on the CS login servers.

Create the key pair thusly:

/usr/bin/ssh-keygen -t rsa -N ” -b 4096 -C ‘<Put your CS userid here>’ -f ~/.ssh-private/<Put your CS userid here>

comment (-C) should be your email address. Note that there are two single quotes with nothing between them, this creates a key without a passphrase. Send me a copy of the key that ends in .pub and I’ll install it on the git server.

It’s very important that you keep close guard of the private key. If you want to use the same private key on your personal machines make sure to use a secure method such as sftp to copy it.

If you’re using mac/linux, when you login and want to use git, you would add your private key to an ssh-agent using something like this:
eval $(ssh-agent)
ssh-add /Users/hays/.ssh/

You can verify that the key is loaded with
ssh-add -l

If you want to use git on windows, you need to convert the key. Here are some instructions:

SourceTree for Windows with SSH key files

Short version is you go to the putty project and download putty-gen and pageant.
-Copy the private key to the windows machine in a safe place
-Rename it with a .ppk extension
-Use putty-gen to convert to a key putty can use
-Use pageant to load the key into ram, pageant is basically an ssh agent for windows

Sourcetree is a good choice of git client, it’s cross platform.