Tino Intro To Java

Last modified: March 29, 2023

Git Setup

What is Git?

Git is a program on your computer that keeps track of changes made to files in a folder known as a repository. GitHub is a website that can store your project in a remote repository, which allows you to store a copy of your repository on the internet, so you can clone it onto any computer. While developing your project, you will keep a cloned copy of the repository on your computer and will push (upload) changes to the remote repository on github as you make changes.

Git saves changes to a project in a database. Every time you commit a change to the project, a record of the change is saved to the database. Because every commit is saved separately, you can review previous commits and restore them if desired. You can also push (upload) your database to an online host such as BitBucket or GitHub so that other team members can work on the same project or so you can work from another computer.

  • Git is a program that keeps track of changes to files in a folder
  • Git stores these changes, known as commits, in a hidden .git folder
  • The .git folder is known as a repository and is a database of all changes you commited.
  • Git can push the database to a remote server to be shared by a team or used individually.
  • The instructions on this page will be for GitHub, but you could also use any other remote repository provider such as Bitbucket. Regardless, you must use private repositories for school projects. Making your code available to other students is against the academic integrity policy, so public repositories for school projects is not allowed. Since we will be using Github Classroom, the repository will be created for you and it will automatically be private as per the assignment settings.

GitHub Setup

Sign Up For GitHub

Go to Github and sign up for an account. Make your username the same as your school email username and associate the account with your school email.

Set your name in your GitHub Profile

  1. Click on your user icon in the upper right corner and select "Your Profile"
  2. Click on "Edit profile"
  3. Write your full first and last name in the "Name" field
  4. Press the "Save" button

Download GitHub Desktop

  • Download and install Github Desktop.
  • Make sure you set your name as your real name and your email as the email for your GitHub account.

Note: If you would rather use git using the commandline, here are instructions for how to use git in commandline.

Configure Your Name in GitHub Desktop

If you failed to set your real name when installing GitHub, do it now:

  • Go to File → Options (or Settings in Mac)
  • Make sure the name and email are your full name and the email associated with your GitHub account.

Github Classroom

Github Classroom allows your teacher to create repositories for you and invite you to work in them. This makes it easier for your teacher to see all your repositories in one place.

To set up a git repo for a Github Classroom assignment, your teacher will provide you an invitation link to click specific to your period. Simply click on the link to get your repo set up in Github. Once your repo is in Github, you can clone it using Github Desktop.

You can find your repository at any time by clicking show in finder / show in explorer in Github Desktop.

Copy your Lode Runner Project Into You Repo

  • Copy your latest version of Lode Runner into into the cloned repository folder.
  • Edit the README.md file and paste in the link to your google doc.
  • In Github Desktop, commit and push your repo.
  • Open the lode runner project that is your repo
    1. Open Greenfoot
    2. Close any scenarios that are open
    3. Go to Scenario → open and browse to your code (by default it will be in Documents/Github/lode-runner-yourusername).
    4. Make a change (like add a comment to a file)
    5. confirm that Github Desktop lists your change. It it doesn't, it means you are not working in the version of your code that is your repo. Please get help before leaving class to ensure you are editing the correct project.
    6. In Github Desktop Write a message like "testing commit" in the summary
    7. press the commit button
    8. press the push button
    9. Go to your repository online and confirm the change to the file was saved
  • Make sure from here on, you always work in that version of your code. In fact, you may want to delete all the random versions scattered around your harddrive.

Dark Mode

Outline