Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • Git Beginners Git Beginners
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Insights
    • Issue
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Computer-ScienceComputer-Science
  • Git BeginnersGit Beginners
  • Wiki
  • Home

Home · Changes

Page history
Add the clone commands. authored Jul 23, 2018 by Andrew James Collett's avatar Andrew James Collett
Hide whitespace changes
Inline Side-by-side
Home.md
View page @ 30147055
......@@ -100,16 +100,50 @@ Now we will copy the key you have just created to your GitLab account.
$ 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
```
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:
![Screen_Shot_2018-07-23_at_07.27.04](/uploads/9709a5aef6b29ce5c681f012cf0d5d54/Screen_Shot_2018-07-23_at_07.27.04.png)
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.
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
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.
![Screen_Shot_2018-07-23_at_07.41.45](/uploads/89ea0a0843d72bfcd81c6c29e2b250ea/Screen_Shot_2018-07-23_at_07.41.45.png)
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
All commands need to be executed within the directory of your git repo.
......
Clone repository
  • Home