This page contains a few essential Git guides. The assumption is that you have already installed Git.

Configuring an SSH key

I highly recommend setting up an SSH key. This will allow you to push and pull from Github without entering your password. You can follow the directions below or use the directions on GitHub.

  1. Open a GitBash prompt.
  2. Type ssh-keygen and hit Enter.
  3. Without typing anything else, hit enter at each prompt ssh-keygen offers, including to have no password.
  4. Type cat ~/.ssh/id_rsa.pub and hit enter. This will show your public key that you just created.
  5. Select this text, being sure to include, right-click and select copy. (Ctrl-C means cancel, so that won’t do what you want!)
  6. Go to to github.com, click on your logo in the top right corner, then select Setting from the menu.
  7. Got to SSH and GPG Keys
  8. Select new SSH key
  9. Paste the key in. This should start with something like ssh-rsa AB2dha..
  10. Type a title, e.g, “MSOE Fall 2023”
  11. Hit the “Add SSH key” button.
  12. Go back to the repo that you want to clone. Where you copy the clone link (the green “Code” button), be sure to copy the SSH version of the clone link, not the HTTPS version.
  13. Go to clone a repo from VCS from IntelliJ as you usually do. Enter the URL and press “Clone” This should now just work without needing to type any password. The first time you connect, it may mention the remote host is unknown. This is OK, you can continue.

Opening a Git-bash prompt for your IntelliJ project

You will need to use the command-line to ensure your git repos are properly configured this quarter. Here’s how you can open a command prompt to run git commands at the command prompt.

  1. In the Project pane on the left, right-click on the outermost folder of your project and say “Open In -> Explorer.” Hit enter to go into the folder. Right-click in the empty space and select “Git Bash here.”
  2. Type git status. This should show you what is checked in and if you are synched (up-to-date) with origin/main or not. But be sure to run git fetch to check that you have any changes that occured on origin/main (that, is on github.com). For example, if a teammate pushed code, you won’t see it until you run git fetch

Pushing and pulling code

I recommend you create new commmits and push them to main each time you finish working for a while, at least once per work day, and as many as a few times in an hour.

  1. At the Git Bash prompt, type git status to see your current status. See above for how to get a Git bash prompt for your project.
  2. Type git add . to add everything in the current directory to Git. If you are in a subfolder, you can type cd .. to come back up to the parent folder. Remeber ls will show you what is in the current folder and pwd will tell you what folder you are running commands in.
  3. Type git status again. This will show the files that you are going to commit.
  4. Type git commmit -m "_______", replacing the blank with a message decribing what’s new in this commit.
  5. Type git status again. This should show that you don’t have commits to make, but that you are ahead of origin/main by a few commits.
  6. Type git push. This should push to main without requiring a password, if you have SSH keys set up as in the first section above.