Getting Git Going
Setup, Iteration 4
A pun and alliteration!
git a version-control system, originally created for Linux kernel development, now a near-religious staple of the Ruby community (and others). You should read "About Git" outside lab. For us, it's a way for you to hand in assignments, and for graders to check your work. Due to its distributed nature, you can also save your work often to your repository, making it easier to roll back changes if something goes wrong.
Configuring Git
It'll be helpful to configure a few things in git first. As
written, these instructions will set global options for your
account on your machine (not for the project/repository).
If you're already using git, you can run these commands on your
projects, and leave out the --global
flag.
Git would like to know your name and email address. To make your life simpler, I have a preference you should set.
Run these commands at a command line:
unix-% git config --global user.name "Your Name Comes Here" unix-% git config --global user.email you@yourdomain.example.com unix-% git config --global branch.autosetupmerge true
To make grading easier, please use your full name (e.g.,
"Jeremy D. Frens"
) and your Calvin email address.
SSH Keys
If you're already using ssh keys, you are free to use your old keys. However, you'll have to use the same keys on your own machines as well as in the lab.
To access your remote repositories, you need to create ssh keys.
Run this command at a command-line prompt:
unix-% ssh-keygen -t rsa
When prompted for a pass phrase, you are strongly encouraged to enter a pass phrase. Remember this pass phrase.
If you copy id_rsa.pub
to other machines and put it
in a file ~/.ssh/authorized_keys
, you'll be able to
ssh to that machine just by typing your pass phrase. Of course,
that doesn't sound very appealing when you might have been able to
do it before with just the account's password. Try running
ssh-add
first.
You will now have files ~/.ssh/id_rsa
and
~/.ssh/id_rsa.pub
containing the private and public
keys, respectively. The id_rsa.pub
public key should
be copied to machines that you want to access with the keys. Since
you don't have access to the csforge machine, you'll have to email
the public key to me.
- Make a copy of the key:
unix-% cp ~/.ssh/id_rsa.pub ~/username.pub
where you replaceusername
with your Calvin user name. - Email
~/username.pub
to me as an attachment. Use your Calvin account!
Renaming the file and using your Calvin account are security issues. Fife would have my head if I didn't enforce them.
If you want to access your git repository on csforge from other
machines, you'll have to copy ~/.ssh/id_rsa
to those
other machines. Do not, under any
circumstance, email any private key. Copy it
using scp
, or use a USB drive (and burn the drive
afterwards).
I might be joking about burning the USB drive. Might.