... | @@ -100,16 +100,50 @@ Now we will copy the key you have just created to your GitLab account. |
... | @@ -100,16 +100,50 @@ Now we will copy the key you have just created to your GitLab account. |
|
$ cat ~/.ssh/id_rsa.pub
|
|
$ cat ~/.ssh/id_rsa.pub
|
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAB/Qw/T0HlOcbh+joCpYjyQQo4X0C0JHDhw08EPxjYs1vC1eiN3Rd6rL7YGhQqhmhduoAwMZszqN8HL/lXVecljbGzh5e6nPt47yrCMO8LRW5tjUc1yF9SVpslqI+ehFX6aFFMByMLCA5Z4LHiukTQ0frmYhzeRnQYuzD8e2nywBCWUeGK+nNmqVbgcZoH6xPHeiLV+g+1mBLOmZzNzHLCzteHXRISzb/3AthRq6YVPFCHRLfubekQCCXlYHYCjA890dQ-s+9SUjBpYXB/VvYKYolW1diXSQ7VvkD38BJlOq6L9pKH0NlAxhAEzUSfrWN0gm8OBkIBb/dksIDxQvUUmvEiD4DW693RUevl/1hZsZ/hQmk3TSdK62C7z7eSlroS59eCcaAVRL009crF3H3gAUjMh/XfBY9nw+8HBpBA6BlOSI29owviZFUexVHcUG6SVkGyaH/Z9R6cYJZnDIRC4MmDNDVUnERR+1dAhgXHIqpYDG0h5cWlDvpzosIAkPK5y+/ExsjCPkRlEX5mMgL7Nm5pmtD/avxCeQRVRRsag//FPY50Nns8a4+J5yZb0uM8eTEAug1CDSNrmSl4ofrchCJxvVo9BQ0yA/kS9I2ffnUhftr/TzhlXQVkGx3/7+aSA6vpXgWByrPiW4fDilPq0Gp8XZJP8DIwiPGt1GXp name@example.local
|
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAB/Qw/T0HlOcbh+joCpYjyQQo4X0C0JHDhw08EPxjYs1vC1eiN3Rd6rL7YGhQqhmhduoAwMZszqN8HL/lXVecljbGzh5e6nPt47yrCMO8LRW5tjUc1yF9SVpslqI+ehFX6aFFMByMLCA5Z4LHiukTQ0frmYhzeRnQYuzD8e2nywBCWUeGK+nNmqVbgcZoH6xPHeiLV+g+1mBLOmZzNzHLCzteHXRISzb/3AthRq6YVPFCHRLfubekQCCXlYHYCjA890dQ-s+9SUjBpYXB/VvYKYolW1diXSQ7VvkD38BJlOq6L9pKH0NlAxhAEzUSfrWN0gm8OBkIBb/dksIDxQvUUmvEiD4DW693RUevl/1hZsZ/hQmk3TSdK62C7z7eSlroS59eCcaAVRL009crF3H3gAUjMh/XfBY9nw+8HBpBA6BlOSI29owviZFUexVHcUG6SVkGyaH/Z9R6cYJZnDIRC4MmDNDVUnERR+1dAhgXHIqpYDG0h5cWlDvpzosIAkPK5y+/ExsjCPkRlEX5mMgL7Nm5pmtD/avxCeQRVRRsag//FPY50Nns8a4+J5yZb0uM8eTEAug1CDSNrmSl4ofrchCJxvVo9BQ0yA/kS9I2ffnUhftr/TzhlXQVkGx3/7+aSA6vpXgWByrPiW4fDilPq0Gp8XZJP8DIwiPGt1GXp name@example.local
|
|
```
|
|
```
|
|
3. Now, in your terminal, copy everything from (and including) the `ssh-rsa` to the end of what would be the `example.local` from the above. You should have copied the entire content of the file.
|
|
3. Now, in your terminal, copy everything from (and including) the `ssh-rsa` to the end of what would be the `example.local` from the above. You should have copied the entire output from the command.
|
|
4. In GitLab, click the top right button by your name (you'll need to be logged in) and choose __Settings__ then __SSH Keys__ from the left menu. It will look like this:
|
|
4. In GitLab, click the top right button by your name (you'll need to be logged in) and choose __Settings__ then __SSH Keys__ from the left menu. It will look like this:
|
|
|
|
|
|

|
|

|
|
5. Paste the key you copied into the *Key* section, and add a name for your key, or accept the default.
|
|
|
|
|
|
5. Paste the key you copied into the *Key* section, and add a name for your key, or leave the default.
|
|
6. Click __"Add Key"__. This option will only show up if the key is correctly copied over.
|
|
6. Click __"Add Key"__. This option will only show up if the key is correctly copied over.
|
|
|
|
|
|
Well Done!
|
|
You have successfully added your key to the server. You can now get your code from the server, and send your changes back to the server.
|
|
|
|
|
|
### First project clone
|
|
### First project clone
|
|
|
|
|
|
|
|
Let's get your code from the server to your local machine.
|
|
|
|
|
|
|
|
1. In the browser navigate to your __Projects__ (top left) and click __Your Projects__. Then select the project you would like to clone to your local PC.
|
|
|
|
2. Copy the git URL by clicking the copy button. Ensure that __SSH__ is selected. See the section encircled in red below.
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
3. Open a terminal and use "cd" to **c**hange **d**irectory to where you would like to store your code. For example, below I create a new directory in my home folder called "git", I then "cd" into that directory.
|
|
|
|
```
|
|
|
|
# "~/" is a shortcut for your home directory
|
|
|
|
$ mkdir ~/git
|
|
|
|
$ cd ~/git
|
|
|
|
```
|
|
|
|
4. Now, finally, we can make a local copy or your code! In terminal type `git clone <what you copied pasted here>`. For example, this is what happens if all goes well:
|
|
|
|
|
|
|
|
````
|
|
|
|
$ git clone git@git.cs.sun.ac.za:slug/netbot.git
|
|
|
|
Cloning into 'netbot'...
|
|
|
|
remote: Counting objects: 430, done.
|
|
|
|
remote: Compressing objects: 100% (57/57), done.
|
|
|
|
remote: Total 430 (delta 52), reused 80 (delta 41)
|
|
|
|
Receiving objects: 100% (430/430), 68.86 KiB | 530.00 KiB/s, done.
|
|
|
|
Resolving deltas: 100% (215/215), done.
|
|
|
|
````
|
|
|
|
|
|
|
|
If you have successfully gotten your code onto your local PC, well done!
|
|
|
|
|
|
|
|
Otherwise, if something went wrong, make a note of the error you encountered and ask a demi for help.
|
|
|
|
|
|
|
|
#### Sending code back into GitLab
|
|
|
|
[TODO]
|
|
|
|
|
|
### Understanding the `git` workflow
|
|
### Understanding the `git` workflow
|
|
|
|
|
|
All commands need to be executed within the directory of your git repo.
|
|
All commands need to be executed within the directory of your git repo.
|
... | | ... | |