Skip to content

Commit d459d8f

Browse files
committed
Adding set-up images and updated tutorial pages for Git
1 parent e68bdcf commit d459d8f

File tree

4 files changed

+133
-13
lines changed

4 files changed

+133
-13
lines changed

version-control/command-line/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ The following set of examples will help you understand how to use Git via the co
1515

1616

1717
### Create and add your project in Git
18-
To start, let's make a directory to store our files and initialise the directory as a Git repository on our local system.
18+
To start, let's make a directory to store our files and initialise the directory as a Git repository on our local system. This is the same as we did in the [Set-up tutorial]((../set-up/tutorial.html)) previously.
1919

2020
```bash
2121
$ mkdir practising-git
2222
$ cd practising-git
2323
$ git init
2424
```
25-
> The first command above will make a new directory (`mkdir`) at the system location you're at within the terminal window. The second command will change directory (`cd`) into the new one you just made. The third command will call the Git program then initialise (`init`) your directory as a local Git repository.
25+
> You may recall this will make the directory, change directory so we're located in it, then initialise it as an empty Git repository.
2626
2727
### Create a file.
2828
We can create a new file in our local directory and add a line to it at the same time, with the below.
8.47 KB
Loading
49.1 KB
Loading

version-control/set-up/tutorial.md

Lines changed: 131 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,149 @@ title: Set-up Git and GitHub
55

66
## Introduction to Git and GitHub
77
-----
8-
Now that we know what Version Control is, let's get set-up with Git on our system and make sure we're ready to start creating our own projects and contributing to others.
8+
Now that we know what Version Control is, let's get set-up with Git and Github on our system and make sure we're ready to start creating our own projects and contributing to others.
99

10-
## Before you begin
11-
Install command line Git for your operating system ([OS X](https://sourceforge.net/projects/git-osx-installer/), [Windows](http://msysgit.github.io/) or [Linux](https://git-scm.com/download/linux)) and open your terminal / command prompt.
10+
## Install and Set-up Git
11+
Install command line Git for your operating system ([OS X](https://sourceforge.net/projects/git-osx-installer/), [Windows](http://msysgit.github.io/) or [Linux](https://git-scm.com/download/linux)) and open a terminal / command prompt.
1212

13-
Download [Github Desktop](https://desktop.github.com/) for Mac or Windows.
13+
Once installed check Git commands works by typing the following in the terminal window.
1414

15-
Now create a directory where you will be storing all your projects. You can call it something obvious such as `code` or `projects`.
15+
```bash
16+
$ git --version
17+
```
18+
This will return the version of Git you've installed and prove it's up and running correctly.
1619

17-
### Set-up your Account Git details
18-
When we make a commit to a respository we need to associate it with ourselves. To do that we can tell Git our Github account username and email address
20+
> Later in the tutorial we'll download [Github Desktop](https://desktop.github.com/).
1921
20-
commits
21-
To associate commits you make to repositories to yourself, we need to set-up a Username
22+
### Create an empty Git repository
23+
Now create a directory where you will be storing all your projects, by typing the following lines and hitting enter after each. You can call the directory whatever you prefer, such as `code` or `projects`.
24+
25+
```bash
26+
$ mkdir practising-git
27+
$ cd practising-git
28+
$ git init
29+
```
30+
31+
> The first command above will make a new directory (`mkdir`) at the system location you're at within the terminal window. The second command will change directory (`cd`) into the new one you just made. The third command will call the Git program then initialise (`init`) your directory as a local Git repository
32+
33+
### Set-up your Git account details
34+
When we make a commit to a respository we need to associate it with ourselves. To do that we can tell Git our Github account username and email address. Type the following lines in the terminal window.
2235

2336
```bash
2437
$ git config --global user.name "Your Name"
2538
$ git config --global user.email "name@domain"
2639
```
2740

28-
### Setup an SSH key
41+
### Set-up a SSH keys
42+
In order to connect to and work with the host of a remote repository you'll need a way to prove who you are before a secure connection is allowed. If you think you may already have SSH keys set-up or just want to see what you have in place, use the following command.
43+
44+
```bash
45+
$ ls -al ~/.ssh
46+
```
47+
> Notice this is a command line statement, not a Git statement.
48+
> In the consoole window look for files named `id_rsa` and `id_rsa_pub`
49+
50+
There are two files to be generated as one is the Private Key that resides on your system and the other is the Public Key that can be shared and added to various services, such as Github, as the other part to authenticate you with.
51+
52+
**# Generate SSH Key Pairs**
53+
54+
Open a terminal window and enter the following command.
55+
56+
```bash
57+
ssh-keygen -t rsa -b 4096 -C "[email protected]"
58+
```
59+
60+
When prompted to `Enter file in which to save the key`, just hit `[ENTER]` on your keyboard to accept the location shown. If there are already keys in that location you'll be asked if you want to overwrite them. Hit `y` or `n` as appropriate.
61+
62+
You'll then be asked to `Enter passphrase` and to reconfirm it - choose a secure one - then hit `[ENTER]` after each prompt and the keys will be generated, along with your password and email as a label.
63+
64+
![RSA Keys Generated](images/setup-rsa-key-generated.png)
65+
66+
**# Add SSH Keys to the ssh-agent**
67+
68+
To avoid having to provide a password every time we connect to a service we can use the ssh-agent on our system. This agent handles passwords for ssh private keys and connections to the remote service we're logging into. This avoids having to send passwords over the network to the service.
69+
70+
Check if the ssh-agent running by typing the following command
71+
72+
```bash
73+
eval "$(ssh-agent -s)"
74+
```
75+
This should return the PID for the ssh-agent which means it has been started in the background.
76+
77+
![PID Number](images/setup-pid-number.png)
78+
79+
Now add the ssh keys to the ssh-agent by typing one of the following depending on your system.
80+
```bash
81+
Windows: ssh-add ~/.ssh/id_rsa
82+
Mac: ssh-add -K ~/.ssh/id_rsa
83+
```
84+
> The -K option is Apple's version of `ssh-add` which adds the passphrase to your keychain for when you add the key to the ssh-agent
85+
86+
You can check what identities have been added to the ssh-agent by typing:
87+
```bash
88+
ssh-add -l
89+
```
90+
91+
### aaaaaaa
92+
.
2993

30-
An SSH key is used to identify trusted computers, without entering a password.
3194
[Instructions on how to generate an SSH key](https://git-scm.com/book/en/v2/Git-on-the-Server-Generating-Your-SSH-Public-Key)
3295

96+
97+
.
98+
99+
.
100+
101+
.
102+
103+
.
104+
105+
106+
107+
108+
109+
110+
111+
112+
113+
114+
115+
116+
117+
118+
119+
120+
121+
122+
123+
124+
125+
126+
127+
128+
129+
130+
131+
132+
133+
134+
135+
136+
137+
138+
139+
140+
141+
142+
143+
144+
145+
146+
147+
148+
149+
.
150+
151+
.
152+
33153
This ends our _Set-up Git and GitHub_ lesson. Is there something you don't understand? Try and go through the provided resources with your coach. If you have any feedback or can think of ways to improve this tutorial [send us an email](mailto:[email protected]) and let us know.

0 commit comments

Comments
 (0)