You can think of GitHub as a cloud service that helps you store and manage your code. Because it also handles version control, it also helps you track and control changes to your code. But what exactly is Git and Version Control?

Version Control

If you have a big piece of software, it may not be safe to be working directly with the official copy of the code. This is especially true if you have multiple people or teams trying to change and test out new featurs of the code. Version control can help developers work safely with code through branching and merging.

Branching allows developers to duplicate part of the source code. This allows them to make changes to their version of the code without affection the original source code. It is only once they have completed their portion of the code that they ask to merge back into the main source code to make it an official part of the code

So what is GIT?

Now that you know the basics of version control, GIT is simply an open-source version control system. It's a distributed version control system that makes the codebase and history available on every developer's computer for easy merging and branching.

Then what is GitHub?

You can have version control and use the GIT control system without connecting the entire system to the cloud. GitHub allows for easy cloud-based git repository hosting. For many new devlopers, GitHub also provides an easier introduction to version control by providing a user interface. Many developers, especially those that have used GIT before GitHub live in the command line.

Sign Up!

Go to and sign-up for an account. You will need an account if you want to take advantage of version control. Technically, any public repository will allow you to look through and download the code base. Depending on the systme you're using, you may not be able to easily clone repositories into your IDE without an account.

The following instructions are for assignments given through GitHub Classroom. If you already have a repository, you can simply visit your repository to look for the git link for cloning into eclipse (skip to step 3 in this section).
  1. Accept the assignment from a link sent by your instructor. This will create a repository on your GitHub account that is linked directly to the GitHub classroom interface. (You don’t need this part if you’re working with your own repository that you created)

  2. Github will create a repository with the started code in it. You will need to refresh the page after about 1 minute. Once the GitHub repository has been created, copy the link to it. See the images below of what you should see on the Github web interface.

  3. You will copy the GitHub repository link by clicking on the green Code button on the right side of the screen as shown below. Keep this window open.

GitHub requires that we use tokens when accessing repositories from 3rd party applications like Eclipse. This means you cannot simply use your current password for the website. You must follow the instructions below to generate a Personal Access Token.

  1. Click on your profile name and go to settings. You must be logged in to do this.
  2. Under Personal access tokens, click on Generate new token.
  3. Give the token a name. Select no expiration and make sure to select the first checkbox called repo as shown in the picture below.
  4. Finally, click on generate a token. Keep this tab open or copy the token temporarily somewhere. You will need it when you clone a repository in eclipse.

Once you have your repository created with the starter file (automatically done by accepting the GitHub assignment), you can now connect that repository to your eclipse workspace. 

  1. Launch eclipse on your computer

  2. The GitHub panel is not open by default unless you have already opened it in the past. Open the panel under the Window menu then Show View then Other…

  3. Select the Git Repositories panel under the Git folder in the pop-up screen.

  4. In the Git Repositories panel, you can right-click and select Clone a Git Repository or look at the upper-right icons and select the Clone a Git Repository icon. If you already copied the link from the Github website, it will automatically paste it into the next pop-up window. 

    Leave everything by default, but I suggest storing your username and password. The password you use here is the token you generated from the GitHub website.

    Go through the windows by clicking next, enter your credentials if it asks, and flick. You can select to import projects automatically on the last page. Finish once you get to the last screen. 

  5. You have now cloned your repository. You will see it in the Git Repositories panel.

    If you do not have the Project Explorer panel open, go ahead and open it now. You can reopen it under the Window menu. We need to get the starter project imported into the project explorer if it is not showing up. If you already see it in Project Explorer you can skip this step.
    Right-click on the repository for the project and select Import Projects. Make sure to select only the 2nd project if you’re given 2 choices (bottom-most).

    You can now make changes to any of the files as you normally would with an eclipse java project

Committing changes creates a log and copies of your files in their current state but it is done locally so changes are tracked only on your computer. Pushing allows you to actually push the changes and logs to the cloud. 

  1. When you have made changes to at least one file, you can push the code to the cloud by right-clicking on the project and selecting Team then Commit as shown below.

  2. The Git Staging panel will open.
    a) U
    nstaged Changes are the files that have been changed but have not yet been marked to be sent to the cloud (GitHub). Click the two Plus icons if you want to add all of the files that have been altered. You typically want this option.

    Add a description of the changes you made to the code. It shouldn’t be a random message like “my commit”, “a push”.
    Select Commit and Push at the bottom of that pop-up to commit and push your changes to the project.

  3. That’s it! Anytime you make significant changes to your project, you should commit and push to the cloud. Note that commit only tracks changes on your local computer, it does not push the changes to the cloud. You want to commit and push so that your changes are always tracked locally and in the cloud.

1. Clone the repository where you want to add projects
Right-click on the project folder under project-explorer as shown below

Select the repository you wish to use

Commit and push. This will push your project to the repository.

If you are working on code on multiple computers, you will likely have different versions on machines until you pull all the changes.

To update an existing project that's linked to your GitHub Repo in eclipse you right-click on the project, select Team, and Pull. Try both pull options until it updates your project. Pulling from GitHub should pull any changes to the GitHub repository since you last pushed or pulled.

Remember, commit and push your code to GitHub anytime you have changes that you want to be tracked! Forgetting to push/commit code from your home device does not excuse you from the work needed to be submitted during class.
  1. I can't clone my repository
    1. Double-check the git link for the repository. It should end with .git.
    2. Access Token Issues
      1. Double-check your access token to make sure your repo is checked under the scope section.
      2. Double-check that you are using your access token and NOT your GitHub website password.
  2. I don't see the project in Eclipse project Explorer
    You did not import projects in the last screen before clicking Finish when you were cloning the repository. You can right-click on the GitHub repo and select import project. Make sure to only select the 2nd folder shown.
  3. Pushing and Committing
    1. I don't see anything in the unstaged panel that I can push to GitHub.
      You may have committed or pushed recently. To force another push and commit, make changes to one file in the project and save. That file should show up in the unstaged section. Anything you previously committed will be pushed to GitHub the very next time you Commit and Push.
    2. I committed but I don't see my files on GitHub.
      You likely did not push. Remember that committing tracks the changes locally on the computer you're using. To push to GitHub, you have to Commit and Push. Right-click on the project and select push. If it is not available, make a change to any of your files and save it You should then be able to Commit and Push as you would normally.
  4. Pulling
    1. My project won't update when I perform a pull from the Team->Pull.
      Try both pull commands under the Team menu. If this doesn't work, do a rebase and select the remote tracking (/*code*/) option.

    2. Try a Reset. Select Reset in the Team's option and be sure to select the Remote Tracking as well as select Hard in the reset type. This will mirror your GitHub repo and should be safe as long as GitHub is the most up-to-date version of the project!
function expand(id){ // alert(id); var element = document.getElementById(id); //element.classList.add("show");; }