Workshops/Git Workshop/Installing Git: Difference between revisions

From London Hackspace Wiki
mNo edit summary
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Here are some quick instructions for installing Git, and getting ready to upload things to GitHub.
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).
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 ==
== Download and install ==
=== Linux ===
Linux, Mac OS X  and Windows download from [https://git-scm.com/downloads Git downloads].


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.
Install with default options.
 
Try to make sure you have at least version 1.7.
 
=== Mac OS X ===
 
A [http://code.google.com/p/git-osx-installer/downloads/list?q=label:Featured graphical installer for Git] is available.
 
MacPorts has it as 'git-core', and Homebrew has it as 'git'.
 
=== Windows ===
 
[http://code.google.com/p/msysgit/downloads/list?q=label:Featured msysgit] is a graphical installer for Git on Windows which comes with all the necessary UNIXy dependencies Git needs.


== 2. Generate an SSH key ==
== 2. Generate an SSH key ==
Line 30: Line 18:
   id_rsa id_rsa.pub
   id_rsa id_rsa.pub


then you're good to go. Skip ahead to step 3.
then you're good to go. Skip ahead to [[#3. Tell GitHub about you|step 3]].


If you don't see any keyfiles, or you get an error like:
If you don't see any keyfiles, or you get an error like:
Line 79: Line 67:


Click 'Add key', and you're all done!
Click 'Add key', and you're all done!
[[Category:Workshops]]

Latest revision as of 15:29, 5 March 2016

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).

Download and install

Linux, Mac OS X and Windows download from Git downloads.

Install with default options.

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:

Github-add-key-screenshot.png

Click 'Add key', and you're all done!