Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Cloning Your Repository

If you want to work directly on SoCS Linux machines or your own PC, you will need to set up an SSH key, authorize access to the GitHub organization containing your repository, and then clone that repository to your SoCS filestore or your PC’s hard disk.

Installing Git

Warning

This is NOT necessary on SoCS machines. Git is already available there.

On your own PC, check if you have Git installed and set up correctly by entering

git

at a command line prompt. If you get a ‘command not found’ error then you’ll probably need to install it yourself:

  • If you are running Linux, you can do this using your distribution’s package manager.

  • If you have a Mac, you can install Git as part of the Xcode command line tools.

  • If you are running Windows, then you should install the Git for Windows distribution. (Note that we recommend the use of Linux or Mac rather than Windows, if possible.)

Setting up an SSH Key

You may have done this last year for COMP1850—in which case you can skip this step and go straight to ‘Authorizing and Cloning’ below.

  1. In a terminal window1, create an SSH key pair with a command like this:

    ssh-keygen -t ed25519 -C "USERNAME@leeds.ac.uk"
    

    Be sure to substitute your University of Leeds username for USERNAME here!

    Important

    When prompted, press Enter to accept the default file location.

    Also, make sure that you provide a secure passphrase. Note that you will not see the passphrase characters echoed in the terminal!

  2. Start the SSH agent if necessary:

    eval "$(ssh-agent -s)"
    

    Then add your SSH key pair to it:

    ssh-add ~/.ssh/id_ed25519
    
  3. Display the public key in the terminal, with

    cat ~/.ssh/id_ed25519.pub
    

    Copy everything that was displayed by this command to the clipboard.

    Important

    Don’t forget the .pub here!

    You want to transfer the public key to GitHub; the private key should remain in your filestore and be kept secret.

  4. In your browser, go to github.com and login if necessary, then click on your profile icon at the top-right of the page and choose Settings > SSH and GPG Keys. Then click on the green New SSH key button.

    Paste the contents of the clipboard into the space provided. Give the key a recognizable title that identifies the environment you are using (e.g., My Laptop or School of Computer Science), then click Save.

See the GitHub guides to connecting using SSH keys and troubleshooting common problems if you need more help with this.

Authorizing and Cloning

Note: you should ignore steps 1 & 2 below if you are working in a fork of the comp2850-oop-work repository.

  1. In your browser, go to github.com, click on your profile icon at the top-right of the page and choose Settings > SSH and GPG Keys.

  2. Click on the Configure SSO drop-down menu that appears next to your SSH key. Select ‘COMP2850-2526’ from list of options and click on the Authorize button. Use your University of Leeds credentials to authorize single sign-on access to the repository.

  3. Go to your repository’s home page on github.com. Click on the green Code button, select the ‘Local’ tab and choose SSH as the Clone option. Copy the repository URL to the clipboard.

  4. In a terminal window on a SoCS Linux PC or your own PC navigate to where you want to clone the repository. Type git clone, then paste in the repository URL that you copied in the previous step. End the command with the name you want to use for the directory that contains the repository, then press Enter.


  1. If you are using Windows, this terminal should be the ‘Git Bash’ terminal provided by the Git for Windows distribution.