Workshops/Git Workshop/Installing Git: Difference between revisions
m (→2. Generate an SSH key: Anchor link step 3) |
mNo edit summary |
||
Line 79: | Line 79: | ||
Click 'Add key', and you're all done! | Click 'Add key', and you're all done! | ||
[[Category:Workshops]] |
Revision as of 18:09, 8 May 2013
Here are some quick instructions for installing Git, and getting ready to upload things to GitHub.
If you're having problems with any of the below, we can sort it out at the workshop (or, preferably, slightly before: I'll be around for at least an hour before the workshop in case anyone needs one-on-one help with their installs).
1. Download and install
Linux
Git should be available via your package manager, usually called 'git-core'. We'll also be using a GUI tool called gitk, which you may need to install from a separate 'gitk' package.
Try to make sure you have at least version 1.7.
Mac OS X
A graphical installer for Git is available.
MacPorts has it as 'git-core', and Homebrew has it as 'git'.
Windows
msysgit is a graphical installer for Git on Windows which comes with all the necessary UNIXy dependencies Git needs.
2. Generate an SSH key
First, check to see if you already have an SSH key. Fire up your terminal (or, on Windows, the 'Git Bash' that msysgit installed for you), and have a look:
$ ls ~/.ssh
If you see some keyfiles:
id_rsa id_rsa.pub
then you're good to go. Skip ahead to step 3.
If you don't see any keyfiles, or you get an error like:
ls: .ssh: No such file or directory
then you'll need to generate a key. Just run
ssh-keygen -t rsa
and hit return to accept the defaults when it asks you questions. It should go something like this:
$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/Users/chris/.ssh/id_rsa): Created directory '/Users/chris/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/chris/.ssh/id_rsa. Your public key has been saved in /Users/chris/.ssh/id_rsa.pub. The key fingerprint is: b5:16:b4:df:9c:2e:21:8c:a8:5a:e2:a7:47:8d:ef:16 chris@pookie.local The key's randomart image is: +--[ RSA 2048]----+ | . | | . . | | + | | . + + o . | | o. S = o + | | o.E . . o | | ..o. . . . | | . +o o . | | ++ o. | +-----------------+
3. Tell GitHub about you
Go sign up for a GitHub account if you don't already have one: https://github.com/signup/free
Now we need to tell GitHub about your public key. In your terminal, print out the contents of your public key file like this:
$ cat ~/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA7PifNLhyb4R5Wqe6jzhD2JUgSuiYA6icRzLf7m3E8L8J +kbw0F+q/80Uvv8GfoWNbWeYt2FDCEzYzWflFTkF+SRpElkr86I3J06frQr8q9ZvEM97Q/geHiAYS/HC IUZlU2YtlOEwps0vaKKzx7RgRV+J0LXlLGB9KqF4eOTLX+EYMThQqKY2oEdchZKbGKuA/3SyNUo98zZJ xav+N0m4DLBCRjySMdWhu0rBvAyn3+eOi4JceLo6JahtYYFFNpMuAGT85afrV3/LCOUiyuFisZDiFVN2 RMirqkoGeJk1J5a0oLF7qpP8QzZCOCBeQ876+9a8kX5BduyGVnJjrYEFZQ== chris@pookie.local
and then pop over to your GitHub account page and copy and paste your public key:
Click 'Add key', and you're all done!