Environment preparation#

Gitlab logo

Installing Git

  • We use Gitlab version management software in Labranet environment on this course
  • In order to use Git environment, student should have Git client installed
  • Installation guide:
    1. Many Linux distributions have Git preinstalled, but for example in Windows and Mac OS operating systems Git client can be downloaded here
    2. Run the installer (default settings can be used)
    3. Verify that Git client has been installed successfully by opening command prompt (Windows) or terminal (Mac) and run the following command: git --version (see the example below)

Repository description for exercises#

  • All exercises are held in one repository, which will be copied (fork) to own Gitlab environment and then clone that forked repository to local computer
  • Exercises will be done in your local computer
  • When exercises are done, all changes will be transferred to forked repository, where teacher can then assess the exercises
  • Below is a presentation of this Git process

Exercise environment

  • Repository will include the following files:
    • Exercise directory
      • ex01-python-fundamentals.ipynb
      • ex02-python-fundamentals.ipynb
      • ex03-data-sources.ipynb
      • ex04-pandas-part-1.ipynb
      • ex05-pandas-part-2.ipynb
      • ex06-numpy.ipynb
      • ex07-data-visualization.ipynb
      • ex08-K-means-clustering.ipynb
      • ex09-KNN.ipynb
      • ex10-Decision-tree.ipynb
      • data_files directory
        • earthquakes.csv
        • gamedata.json
        • netflix_titles.xml
        • voice.csv

Creating a copy of the original repository#

  • Take a copy of the original repository by following these steps:

    1. Go to address https://gitlab.labranet.jamk.fi/hantt/ttc2050-exercises
    2. Click the Fork button Fork button
    3. Choose your own account in the Namespace section
  • Now you should have a copy of the original repository

  • By default, all repositories are public so set your repository to be private by following these steps:
    1. Go to your repository and choose SettingsGeneralVisibility, project features, permissionsProject visibility and choose Private
    2. Apply the changes by clicking Save changes

Cloning the repository to your own computer#

  • Copy the url of your repository, which will be used for cloning process (check the guide below)

  • Clone your fork repository to your computer by following these steps:
    1. Open Git GUI program
    2. Choose Clone Existing Repository
    3. Set the url of your fork repository to Source Location section
    4. Set the directory of your choice to Target Directory section
    5. Finally choose Clone
    6. Verify that cloning has been completed successfully by moving to the target directory in your computer and ensure that all exercise files are found inside the directory
  • Clone your fork repository to your computer by following these steps:
    1. Move to the directory where you want to clone the source directory called ttc2050-exercises
    2. Use the command git clone https://gitlab.labranet.jamk.fi/user/ttc2050-exercises.git where user is your LabraNet username (for example https://gitlab.labranet.jamk.fi/h1111/ttc2050-exercises.git)
    3. Verify that cloning has been completed successfully by listing the content of the cloned directory with the commandls -l ttc2050-exercises

Returning the exercises#

  • When all exercises are ready, return them by following these steps:
    1. Open Git GUI program
    2. Choose Open Existing Repository and choose repository directory (you can also do this from the main view under the Open Recent Repository section if your repository is listed there)
    3. List changes by pressing Rescan button
    4. File listing for non-selected files should be found under the Unstaged Changes section
    5. Choose exercises so the changes will be moved under the Staged Changes (Will Commit) section
    6. Write the message for the return ("Exercise return") to Commit Message field and choose Commit
    7. Transfer the changes to your repository by selecting Push and choose Push from opening window (default settings can be used here)
    8. If asked, input your Labranet credentials and choose OK
    9. Open browser and move to your repository in address https://gitlab.labranet.jamk.fi and ensure that all the changes have been successfully transferred
    10. Your repository should now be in private security setting. Add permissions for the teacher by following these steps:
      1. Choose Project informationMembers
      2. Add teachers account hantt to the Gitlab member or Email address field
      3. Use setting Reporter for the Choose a role permission field
      4. Sent the invitation by pressing Invite
    11. Finally, return your repository url to Moodle's return box for assessment. Important: Return your repository url at the moment when you are certain your repository can be graded (not earlier)!
    1. Move to directory where you initially cloned your repository
    2. All changes can be seen with command git status
    3. Not staged changes can be added with git add file_path/file_name (for example git add exercises/exercise-01.ipynb)
    4. When all exercises have been added for commit, run the command git commit -m 'Exercise return'
    5. Transfer changes to your repository with command git push
    6. Provide Labranet credentials if asked
    7. Open browser and move to your repository in address https://gitlab.labranet.jamk.fi and ensure that all the changes have been successfully transferred
    8. Your repository should now be in private security setting. Add permissions for the teacher by following these steps:
      1. Choose Project informationMembers
      2. Add teachers account hantt to the Gitlab member or Email address field
      3. Use setting Reporter for the Choose a role permission field
      4. Sent the invitation by pressing Invite
    9. Finally, return your repository url to Moodle's return box for assessment. Important: Return your repository url at the moment when you are certain your repository can be graded (not earlier)!