COP-2805C (Java II) Project
Using Git and GitHub with an IDE

The Git project

Due: by the start of class on the date shown on the syllabus

Description:

In this project, you will learn to use some of the “team” features of your preferred IDE (Eclipse, Apache NetBeans, or IntelliJ IDEA).  We will use the “Git” source code control system to allow all members of the class to work on the same project at the same time, and then to merge in your changes.  This is a “real-world” way of working on code; few developers work on real projects by themselves.  (And even then, version control is often useful and used.)

The project is a very simple one.  The source file SayHello.java has a main method you need to edit.  Add a statement to main to greet the class by displaying a unique string (so your contribution differs from other students'), which should include your name.  (You are free to add additional output if you desire, such as a quote or joke.)  The purpose is simply to learn to use Git, which takes time and lots of practice.  You can try using various IDEs, and make multiple changes if you want.

For this project, every student must individually commit their change(s) and submit this assignment.

I have created a Git repository you can access from the GitHub.com.  This repository contains the initial version of SayHello.java, a README.md file, a .gitignore file, and a bunch of other files needed for a Maven project.  (There are also some Eclipse IDE and IntelliJ IDEA project files in there, to make importing into those IDEs easier.)  The initial version has a greeting from the instructor you can use as a model for your own additions.  (While it is okay to be a little creative, say by adding a joke or quote, just don't go overboard and add more than a few lines!)  The URL of the repo is shown below, in the step-by-step directions for each IDE.  You can also view the project's website (generated by Maven from the initial version).

Following the directions below, you will create a GitHub account for yourself, then clone the project's repo.  (IDEs generally require a local repo to work with as well.)  When you are done making a set of changes (for this project you only need to add two lines to main) to your local copy and testing that the result still compiles and runs, you must commit your changes.  That updates the local (on your PC) repository.  Next, you push your changes to the class' GitHub repo.  During this step you may discover another student has committed some changes after you had checked out the project.  If so, you will need to merge your changes into the new version.  Or you can update your local copy of the project, over-writing your files with the latest ones from the repository, and make your change again.  In either case, you must commit again, and then retry the push.

In the real world, you might not push changes directly to the master branch.  Instead, you might make your change in a branch, then make a pull request for the project's team to review, comment on, revise, and hopefully, approve.  The project leader would then pull in your branch (if it was in a different repo) and merge it into master.

See Pull Requests and Patches for more information.

You can perform other Git related operations with your IDE.  It is expected that students will explore some of these operations.  Eclipse assumes you may have multiple projects per repo, and thus creates a project top-level folder within the top (root) of the repo.  NetBeans and IntelliJ IDEA don't do that by default, but they are perfectly happy either way, so I set up the GitHub class repo using the Eclipse conventions.

Another issue is that Eclipse doesn't easily import non-Eclipse projects with existing sources.  It can be done, but it was easier to create the default Eclipse project files and add them to the repo.  They should be ignored by NetBeans, and it shouldn't be modifiable by Git; the repo was set to ignore changes to those files.

You can read about using these features with your IDE using the built-in help system you have learned to use in a previous project.  For more information visit the Git Home, especially the Git book online, and the other resources found on our class web page.

Requirements:

If you accidentally corrupt the class repo, you should notify your instructor as soon as possible.

Using your preferred IDE, complete the steps shown below for your IDE to setup a Git project.  Then edit the shared Java program, test it, commit your change(s), and finally, push your changes back to the class repository (merging if necessary).

The first step is to make sure your IDE includes the latest Git plug-ins.  It almost surely includes Git support by default but if not, see your IDE's documentation to see how to add plug-ins.  (You can add some other extras if you wish, but until you are comfortable with your basic IDE features, I suggest you resist the temptation to install much extra.)  You should also check for IDE updates, and install any found.

Next you need to create an account on GitHub.com.  This is easy, fast, and free.  When you have completed this step, you can create your own repositories there for practice.  I strongly suggest you create one (or more) and practice using them with your preferred IDE before attempting any changes to the project's repo!  (When done, you can delete any of your GitHub repos from their “Settings” screen.)

GitHub currently (1/2021) allows users to use passwords, but is phasing that out.  To use HTTPS in the future, you must use a personal access token.  (If using SSH, you don't need this.)  See Creating a personal access token from the GitHub.com site.

You must send an email containing your GitHub account name to your instructor.  Only those listed as collaborators on GitHub.com can push changes to the COP-2805C-2021 repo there, and I need to add your account name to the list.  Once you are added by me, you will receive an email message from GitHub with an “invitation” to collaborate; you need to accept that before you are a collaborator.

There are Windows GUI and command line tools for working with Git and/or GitHub.  They are not full IDEs however; you view your repos, create new ones, and with some of these tools, add files or commit new versions of files.  As the Git plug-ins for most IDEs includes a full version of Git, you don't need any other tool.  (That is, this step is optional).  Still, it is handy to be able to run various Git commands outside of an IDE, especially when trying to learn.

I would suggest installing “Git for Windows” from git-scm.com.  Git for Windows includes a sub-set of the command line Linux tools, just the ones you would need to work with Git at the command line.  (It also includes a Git GUI, but it doesn't do much.)  Windows 10 includes Linux, which includes Git.  Installing Git for Windows is probably your easiest choice.  I recommend configuring it (during the install) to allow you to run git from a DOS command line.  Configure the other choices as you wish, but sticking to the defaults is generally safest.

After completing the IDE-specific steps below, don't forget to continue with the remaining steps of the project.

Step by Step Directions for Eclipse IDE:

  1. Start Eclipse.
  2. (Optional step)  Close any currently open projects.
  3. Next you should configure Eclipse with some settings.  (If you don't, the Git settings will cause a dialog box to appear when you make your first commit.)  Go to the Windows menu and select Preferences→Team→Git→Configuration.  Add entries for “user.name” with your full name, and “user.email” with a working email address (such as your HCC Hawkmail address).  This information will be automatically included with every commit.

    If the email address you used is unknown to GitHub, your commits will not be linked to your GitHub account name!  This is because GitHub accepts commits if you know a username and password (or use an appropriate SSH key), but labels commit objects by the email address in the commit.  You can list several email addresses in your GitHub account and then your commits will be recognized from any of them.  Follow these directions to add additional email addresses to your GitHub account.

    From Preferences→Team→Git, you can set a default location for all your Git repos.  (I use ...\Documents\GitRepos.)

    From Preferences→General→Workspace:  Set the default text file encoding to UTF-8.

    It's not required to change this setting for our project, but the “Package Explorer” hides many files by default.  In particular, it hides the “.gitignore” and similar files.  To fix that, click on the tiny downward-pointing triangle on the right of the Package Explorer tab bar, and click on “Filters and Customization”.  Now un-check “.* resources”.  To re-hide the Eclipse project files, select “Name filter patterns” at the top, and enter “.classpath, .project, .git, JRE*” (without the quotes) in the box.  Hide other files if you wish, or hide nothing at all — it's your choice.

  4. It isn't required, but you can use the SSH protocol and keys instead of passwords to access remote repos, including on GitHub.  If you wish to use keys, see Setting up SSH keys below.
  5. With Eclipse all set up, you are ready to start work.  (You could install additional software to add nice features to Eclipse, but I recommend you keep it simple until you know Eclipse better.)  Since you are contributing to an existing project, you will import it:
    1. Select “File→Import...”, then select “Maven→Check out Maven Projects from SCM”, then click Next.

      To allow Eclipse to easily import Maven projects, you may need to update the Eclipse Maven-Git connector, as the version that you get by default with Eclipse may be too old (a bug in Eclipse in 2019).  If you have any problems importing Maven projects (such as ours on GitHub), this may be the reason, and you should get the latest version:

      1. Go to the menu item Help → Install New Software.  Click on the “Manage...” button.
      2. Make sure all the sites listed are selected.  (Often, “Latest Eclipse Release” is not selected.)
      3. Next click on the “Add...” button.  Enter something for the name (I chose “Maven SCM Handler for EGit v0.15.1”), and “https://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-egit/0.15.1/N/LATEST/” for the location (without the quotes).  (This is the latest version as of 1/2020.  You can check for a newer version by looking in https://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-egit/ for a newer version.  If you find one, the correct URL is the same but with the newer number (instead of “0.15.1”.)  Click the Add button, then the Apply and Close button.
      4. Back at the Install New Software dialog, select the site you just added. A single item, Maven SCM Handler for EGit should appear.  Click the checkbox to select it, click Next button, and proceed to click through the rest of the install process.
    2. Enter the correct URL for the remote repo.  You can do this easily with GitHub by opening the repo in your web browser.  The correct repo for this project is named https://GitHub.com/profwpollock/COP-2805C-2021, but that's not the URL to use.  On the right of this repo's web page, you will find a “Clone or Download” button:

      Picture of GitHub repo showing URI and copy button

    3. If using SSH (skip this step if using HTTPS):  Click the “SSH” link, to change the URL from HTTPS to the SSH protocol, since you are using SSH.  (Only authenticated users can push their commits to the class' GitHub repos, so you must either use HTTPS (with a password or access token) or use SSH.)
    4. Click the copy button.
    5. Back in the Eclipse import wizard, paste the URL you copied.
    6. If using SSH (skip this step if using HTTPS):  Select “SSH” from the “Protocol” drop-down list.  Don't change the username; it should be “git” and not your GitHub name.
    7. Click Finish.  The new imported project should appear in the project explorer window.

      If all is well, you have cloned that Git repo locally too.  You are now ready to complete the project.


Step by Step Directions for NetBeans IDE:

  1. Make sure you have the latest version of Apache NetBeans installed.  (Many people mistakenly install a very old version from Netbeans.org.)  Then start NetBeans.
  2. Make sure you've installed the Git and the Maven plug-ins.  (They may be installed by default.)  Also useful (but not required) are the following plug-ins:
        Display README files in project view
        Git Toolbar
  3. Next you should configure NetBeans with some settings.  (If you don't, the default Git settings will cause the wrong user name and especially, the wrong email address to be used, when you make commits.)  Go to Team→Git→Open Global Configuration.  Add entries for “user.name” with your full name, and “user.email” with a working email address (such as your HCC Hawkmail address).  This information will be automatically included with every commit.  The resulting .gitconfig file (in your HOME directory) should then look something like this (the file may have additional entries too):
    [user]
        name = Hymie Piffl
        email = hpiffl@hawkmail.hccfl.edu
    

    (Of course, you need to use your actual name and email address.)

    If the email address you used is unknown to GitHub, your commits will not be linked to your GitHub account name!  This is because GitHub accepts commits if you know a username and password (or use an appropriate SSH key), but labels commit objects by the email address in the commit.  You can list several email addresses in your GitHub account and then your commits will be recognized from any of them.  Follow these directions to add additional email addresses to your GitHub account.

    Set the default file encoding to UTF-8.  You can change the file encoding for any one project by right-clicking on the project name (in the Projects tab), selecting Properties, and changing it there.  To change the default for all new projects, follow these directions from StackOverflow.com.

  4. With NetBeans all set, it's time to create your project by cloning the class project from GitHub.  Copy the correct Repository URI for the remote repo.  You can do this easily with GitHub by opening the repo in your web browser.  On the right side of the repo's web page (https://github.com/profwpollock/COP-2805C-2021), you will find a “Clone or Download” button; click it.
  5. If using SSH (skip this step if using HTTPS):  Click the “SSH” link, to change the URL from HTTPS to the SSH protocol, since you are using SSH.  (Only authenticated users can push their commits to the class' GitHub repos, so you must use either HTTPS (with a password or access token) or SSH.)
  6. Click the copy button.
  7. Back in NetBeans, from the “Team” menu, select “Git→Clone...”.
  8. Paste the URL into the NetBeans dialog box.
  9. If using SSH (skip this step if using HTTPS):  The copied SSH URI won't work in NetBeans!  You have to add the correct protocol to the front, and change the first colon to a forward-slash.  For our project, the copied URI of “git@github.com:profwpollock/COP-2805C-2021.git” should be changed to “ssh://git@github.com/profwpollock/COP-2805C-2021.git”.  Next, browse to locate your private key file, created outside of NetBeans.  (Or just use HTTPS and a password or access token.)  Make sure the URI is correct; if using SSH, make sure the Username field is filled with “git”.
  10. After filling out the URI (and either your GitHub username and password, or your SSH key setup), click Next.  Make sure the “Master” branch is selected, and click Next.
  11. Click Next to create a clone of the repo (under the NetBeans projects folder).  This should also scan for projects.
  12. NetBeans will recognize this as a Maven project, so no further steps are required.  You can however rename your project by right-clicking on it.
  13. That's it!  You should now have a local repo, and a NetBeans project linked with it.  You are now ready to complete the project.

    Unlike Eclipse, NetBeans integrates Maven.  Right-click on the project, and see the menu options (Build, Clean and Build, Clean, etc.).  Each call the corresponding Maven command when clicked.  Additionally, you can custom goals to the menu.


Step by Step Directions for IntelliJ IDEA IDE:

  1. Start IntelliJ IDEA.
  2. Configure your IDE with some settings.  Open File→Settings→Editor→File Encodings.  If you plan on following my advice, set all encodings to “UTF-8”.  (Or you can just set this later, once you've downloaded the repo and setup your local project.)
  3. Go to “File→Other Settings→Structure for New Projects...” and make sure the “Project SDK” shows the correct JDK version you have installed.  Below that, choose the matching Program Language Level.  (For example, for version 13.0.2 of Java, the language level should be “13 - No new language features”.)
  4. If using SSH (skip this step if using HTTPS):  Go to Settings→Version Control→Git.  Make the “Path to Git executable” is set correctly and working.  (Of course, you did already install Git for Windows, right?)  Next go to Settings→Version Control→GitHub and check the box to “Clone git repositories using ssh”. 

    Like NetBeans, IntelliJ IDEA can use SSH but cannot manage your SSH keys.  The initial setup of SSH keys is more complex than with Eclipse (which can manage keys) or NetBeans.  See below for details.

  5. If using HTTPS (skip this step if using SSH), you can have IntelliJ IDEA remember your GitHub credentials.  Go to Settings→Version Control→GitHub to enter in your info.  GitHub will generate a token for your IDE to use.  If the token expires or is missing, click “Log in” to generate a new one.
  6. With IntelliJ IDEA all set, it's time to create your project by cloning the class project from GitHub.  Copy the correct Repository URI for the remote repo.  You can do this easily with GitHub by opening the repo in your web browser.  On the right side of the repo's web page (https://github.com/profwpollock/COP-2805C-2021), you will find a “Clone or Download” button; click it. 
  7. If using SSH (skip this step if using HTTPS):  Click the “SSH” link, to change the URL from HTTPS to the SSH protocol, since you are using SSH.  (Only authenticated users can push their commits to the class' GitHub repos, so you must either use HTTPS (with a password or access token) or use SSH.)
  8. Click the copy button.
  9. Back in IntelliJ IDEA, from the Welcome window select “Check out from Version Control→Git”.  Paste in the URL and click Clone.  Say yes to open the IntelliJ IDEA project.  A notification appears about needing to import Maven projects.  Either say yes, or just enable “auto-import” (my choice).

    You should be able to run the main or the test by selecting an appropriate Run configuration, or from the Maven menu (double-click Install from the lifecycle list, then to run your program (if it built successfully), double-click on exec:java from the Plugins list).

  10. That's it!  If all is well, you have a local project and Git repo as well.  You are now ready to complete the project.

Complete the Project Using any IDE:

  1. At this point, you should have a local copy of the project.  You should start by reading any README or license files included with the project.  (It may be easier to view those from the GitHub site directly.)  Open the src→main→java→mypkg package (folder) to see the “SayHello.java” file.
  2. Run the application, to make sure it works.  If not, you can either fix the issue yourself or create an “Issue” on the GitHub site for the repo.  You can also add to the repo's Wiki.  Note, each IDE has different methods for running projects, especially Maven ones.  Eclipse has separate run and test buttons from the various Maven buttons.  NetBeans integrates its run and test buttons with the correct Maven actions, so there's no separate Maven buttons.  IntelliJ IDEA has separate run configurations from Maven, but has the best Maven tools of all IDEs.  However, you may have to configure the Maven actions (and the normal run and test actions) the first time.  In all cases, you can find addons/plugins/extensions that can make it easier to run Maven projects or execute Git commands.
  3. Edit SayHello.java and add your code.  Make sure the code will compile and run, and displays your greeting along with the other greetings from your fellow classmates.  Save your work.
  4. At this point, you are only changing and saving your project's (Git's working directory) copy.  Next you need to update your local repo with the changes.

    Commit your changes to save your work to your local repository.  Enter a comment for your commit (called either a log message or commit message) describing your update.  (To receive full credit, you must include an appropriate commit message.)  Before committing, make sure your commit includes SayHello.java and does not include any other files.  Not all IDEs ignore the configuration files, even if listed in the .gitignore file, so double-check before making the commit.

    In short, make sure your commit ONLY includes your few added lines to SayHello.java, and does not touch other lines in that file and does not include any other files.  If you are uncertain if your commit is correct, send a screen-shot showing the changes to your instructor (or a fellow student) before making the commit.

    If using IntelliJ IDEA, it is at this point you need to enter your email address (the one you told GitHub about) and your name.  This is because the other IDEs store a single name and email in their settings, and automatically use that.  But IDEA allows multiple people to work on the same computer and commit, so it keeps a drop-down list of previous committers and there is no prior configuration needed.  Simply add your name and email in the “Author:” box in the commit dialog.  The format should match this example:

    Hymie Piffl <hpiffl@example.com>

    Either click in the box and type control+space to see the list, or just start typing the name and it will auto-fill the box.

  5. As stated above, examine your commit and note the changes it makes.  The changes should make sense to you: they should show you added just a few lines and didn't delete or change any other lines.  If they do not show that, you've probably made a mistake.  For example, if the whole file shows as deleted and replaced, you probably have a problem with your line ending settings in your IDE.  The proper settings are stated in the README.md file.  If this happens after you make the commit, you can delete (“revert”) your commit and try again after fixing your settings.  (If you cannot figure that out, delete your (on your PC) project, fix the settings, then try the edit and the commit again.)

    Note that only the Master branch of the class' GitHub repo will be graded.  So if you did your change in a branch, be sure to merge your commit into your master branch before proceeding with a push.  When finished with this project, you should close the project in your IDE.  (This should help prevent “accidents”!)

  6. Push your commit(s) from your local repo's master branch to the “origin” (the GitHub class repo's master branch).  If this fails to work due to a conflict, consider yourself lucky: you get to practice doing a merge!  See the merge information below for general info, but most likely you will need to read or watch a Git merge tutorial for your IDE.
  7. Next, create a patch, sometimes called a pull request.  How you do this depends on which IDE you use, or if you simply want to create one directly on GitHub.  (Using GitHub directly is often best, but does require you to have the repo cloned on GitHub and not just locally on your computer.)  You will make a local pull request (patch) you can email to someone.  Such a request is often just a patch file: a text file that shows the differences between what the repo has and what you think it should have.

    With Eclipse, right-click on your project and select “Show in History”.  The Master branch's HEAD should be the commit with your change in it.  Right-click on that commit in the history, and select “Create Patch...”.  Click on File to save your patch (a pull request) in a file; the default name of the file defaults to the first line of your commit message, but you can change that if you wish.  Click Next.  Now you can choose a patch file format.  Eclipse can only apply patches made in the “Eclipse workspace” format, but for this project use the standard “Git (e-mail header)” format.

    With NetBeans, with the SayHello.java file showing, click on Team→Show History.  The Master branch's HEAD should be the commit with your change in it.  Click on the box with the plus-sign, to expand your choices.  Now click on “Export Commit...” to make a patch file (a pull request).  Save it someplace (say, on your desktop) with a descriptive name, something like “hpiffl pull request”.

    With IntelliJ IDEA, if you haven't made a commit yet, click the Git→Create patch from local changes... menu item.  Add a commit message and save the patch as a file (the commit message is used to name the file).  This won't work if you've committed your changes already!  In this case, click Git→Show Git log.  The log should appear showing all the commits.  Select one (or control-click to select multiple) commits whose changes you wish to include in a patch.  Finally, right-click the selection and click on "Create patch...".

    You should examine your patch file in a text editor.  See if you can understand the format; someday you may wish to tweak one of these files before sending off the email.  (It is common to add a paragraph at the top to explain the patch.)  Your IDE can show it to you with color and syntax highlights; that may help you understand the format.

    (View an Email containing a patch.)


Merge Information

If you opened the project a while ago, others may have made changes since you downloaded the files.  In this case, Git may not be able to automatically push or merge the changes since both changes were to the same file.  (The error message will say something about fast-forward failed.)  You must fetch the new commit(s) into your local repo, then merge your changes with those (locally).  All three IDEs have nice merging tools; they work best with a wide-screen monitor.  You should definitely review your IDE's tutorial for Git merging before trying this out!  After reconciling the differences (and testing to make sure the code still runs), you complete the merge with a commit.  Then you can push that merge commit to GitHub without problems.


(Optional) Additional Steps:

You should explore some of the other items on the “Team” or VCS menu.  You are encouraged to create your own projects locally and on GitHub, create branches, and play with them.  (A simple project with just a ReadMe.md file can be used to practice merging: make a local project, edit the file directly on GitHub, then make a change locally and try to push it.)

Try creating your own repo on GitHub, it's easy.  I suggest you check the box to create an initial README.md file.  Without at least one commit in it, it isn't possible to clone a repo.  (You can push to an empty repo, however.)  Adding this file means you can clone the repo easily using any IDE or even the command line.

From the repo's settings page, you can delete a repo when you are done with it (or after you messed it up badly and want just to start over).  You can create as many repos as you like on GitHub.  They are generally public; private repo generally cost money (but since Microsoft purchased GitHub.com, some private repos are now free).  (A public repo means anyone can clone and view it, but only you and those you add as collaborators can push changes to it.)

Working with a local repo is easier than working with a remote one.  You can create a new project and share it using your IDE's Team (or whatever) menu.  This will create a local Git repo for that project only.  With this, it is easy to practice making many commits, checking out old ones, creating branches, and merging branches.  Since you only are using a private, local repo, there is no push or fetch (pull) to worry about.

If you mess up working with your IDE and want to start over, that is easy too.  Simply delete the project (including all files) from the IDE.  Next, find the Git repo created on your computer for that project, as it is sometimes separate from the IDE's project folder.  Then delete that too.  Now you can import the Git repo from GitHub again and create a new project.

Please spend some time exploring the Git resources from our class web site.  They can really help, and I promise Git has many more features than you will use on this simple project.  Try not to forget the purpose of this project: to spend time learning Git.


(Optional) Set Up SSH Keys:

NetBeans and IntelliJ IDEA can use SSH keys, but can't generate them.  You will need additional software to create a pair of keys, each in a file.  You then configure your IDE with the names of the files containing your keys.  You can use the keys generated by Eclipse or by the ssh-keygen tool that comes with Git for Windows.  (Mac and Linux users should have such tools installed by default.)  Tortoise Git also can be used to create keys, but that is not discussed here.

Launch the Bash (command line) window, and follow the directions from Git-SCM.com/.../Generating-Your-SSH-Public-Key or from help.GitHub.com/.../generating-an-ssh-key.

Eclipse can generate and use SSH keys:

  1. Go to Window→Preferences→General→Network Connections→SSH2, and click on “Key Management”.
  2. Click “Generate RSA Key”.  (DSA keys would work too.)
  3. Give the key a useful name, for example “wpollock@home” or “WP-RSA-2014-01-01”.
  4. Click the “Save Private Key” button.  This will save the private key in a file you name (such as “wpollock-ssh-key”), and also save the public key in a similarly named file (in this case, “wpollock-ssh-key.pub”).  You don't have to password protect your private key, but keep in mind anyone or any malware with access to your computer can use that key!  So best practice is to password protect your private keys with good passwords.  Make a note of the files' location.  Make an off-line backup of the files as well.
  5. The public key will also show once it is generated.  Copy the public key that appears to the clipboard.
  6. Log into GitHub and go to the “Profile→SSH Keys” page.
  7. Click the “Add SSH Key” button, and paste your public key.  (Note the public key is one long line; a trailing newline is fine.)

Creating Keys from the Command Line:

Open Git for Windows command line window (or CygWin or the Linux Subsystem for Windows 10, or a terminal window on a Mac).  The prompt for the window may vary, I will show it as “”.  At the prompt, type the following:

$ ssh-keygen -t rsa -C "your-name@github.com"

This will generate an RSA key pair named id_rsa (the private key file) and id_rsa.pub (the public key file).  Note that not having a password on your key sounds convenient, but it is in fact dangerous!  So don't do that.

You can generate keys using PuTTYGen, but you must export them so they are in the OpenSSH format. See StackOverflow.com for instructions.

Once you have your key pair, you must upload the public key to GitHub.com so you can use it.  Follow the directions at help.GitHub.com to upload your public key.  (Don't forget to make backups of your key files!)

• Keys cannot be recovered if lost.  Make sure you have a good backup copy (or two)!
• Use of your private key may have legal implications.  Either protect your private key with a strong password, or don't use that key for any other purpose.

To test your key, follow the directions at help.github.com/articles/testing-your-ssh-connection.

If you have trouble using keys, remember you can use HTTPS protocol instead (with a password or access token).  You can also ask your instructor for help.

If using IntelliJ IDEA, you need to use some external (“native”) SSH client, and not the internal one that comes with IDEA.  This is because you cannot configure IDEA with the name of a key to use or have multiple keys.  IDEA will use the native SSH client if installed (and found on PATH), so just use that and add keys to that:

  1. Generate the key to use as described above.
  2. Find the key file on your disk.  Generally it's in a folder named .ssh or something similar, in your home directory.
  3. In that same folder, edit (or create if not present) a file named “config”.  In this file you can list projects, and for each one list the user, hostname, and key file to use for that project.  To keep this simple for now, just add a single key for yourself to use with GitHub, not one key per project.  A sample config file might look like this:
    
    # Default key used for GitHub:
    Host github.com
        User git
        HostName github.com
        IdentityFile ~/.ssh/id_rsa
    

    (Note the user name is always just “git” when using SSH.)


To be turned in:

Submit a copy of your patch file (or pull request) to the Canvas dropbox for this assignment, which shows your SayHello.java Java source code additions.  (No credit if your changes aren't found on the master branch of the class' GitHub repo, or if you don't use an IDE (and Maven) to make the changes.)

You can send as email to (preferred).  If email is a problem for some reason, you can submit the patch as an attachment, or you may turn in a hard-copy.  In this case the pages should be readable, dated, and stapled together.  Your name should appear on the first page.

Submit to the correct Canvas dropbox for this assignment.

Please see your syllabus for more information about projects, and about submitting projects.