Lab 1

CS203
Spring 2016
February 1

  • Create a Git account
  • Send your new account name to jones@cs.vassar.edu
  • Set up Git configuration
  • Create a simple Java program
  • Create local repository in the CS203 directory
  • Upload your CS203 folder to your private remote git repository within the Vassar-cs203 account.
  1. Go to https://github.com and create an account
  2. Configure git for your CS Linux account:
    • Login and enter the following commands from your home directory at the Linux prompt:
      git config --global user.name "Your Name"  
      git config --global user.email "your@email.com"  
      git config --global color.diff auto  
      git config --global color.status auto  
      git config --global color.branch auto
  3. Set up your public sshkey so that you don't get prompted for a password every time you access your GitHub account:
     ssh-keygen -t rsa -C "your@email.com"

    Note: you will be prompted for what file to save the key in–take the default; you will also be prompted for a passphrase–make one up you can remember!!

    • point your browser to https://github.com/ and login to your GitHub account
    • in the upper right corner, click on the Account Settings icon (it's the second icon from the right; hover over it and it should tell you which one it is)
    • along the left hand side of the page, click on SSH Keys, and click the button to add an SSH key
    • in the Title field, type in your Vassar email address
    • from your Linux prompt, cd into your .ssh directory, and type the following command:
       cat id_rsa.pub
    • copy/paste your public SSH key from the terminal into the Key text area of your browser. Be sure to copy everything from the end of the command to the beginning of the next prompt.
    • click the Add Key button
    • test if all went well by trying to ssh into GitHub:
       ssh -T git@github.com 

      Note: you may be prompted about trusting GitHub's fingerprint. Reply 'yes'

    • DO NOT CONTINUE UNLESS THIS LAST COMMAND WAS SUCCESSFUL
  4. Email your GitHub account name to jones@cs.vassar.edu so I can set up a private repository for each of you in our private Vassar-cs203 account. In the future you will use the private repository that I will create for you. I will be adding you to various team repositories during the term as well.
  5. Create a cs203 directory in your linux account. I suggest placing the cs203 directory within your home directory. Each of your individually written projects will be in a subdirectory within this one.
  6. Create a simple Java program in a directory within cs203. Please use descriptive names for your program folders so I can find them easily.
  7. cd into your cs203 directory. We will first create a local repository in your Linux account. All of your individually written programs will also be stored remotely at github in one cs203 directory.
  8. Type the following to create an empty local repository:
     git init 

    You should see a .git folder within your cs203 folder. (From the command line, type 'ls -a' to see it.)

  9. Add your files to the staging area with the following command. Don't forget the dot:
     git add . 
  10. Create a snapshot:
     git commit -m 'First snapshot' 
  11. The programs in your CS203 directory are now backed up to your local repository.
  12. Make sure you are still in your CS203 directory before proceeding.
  13. Use the git remote add command to stage your files for the remote repository on GitHub (see the Git reference). It should look something like:
     git remote add origin https://github.com/Vassar-cs203/YourVassarEmailName.git 
  14. Use the git push command to copy your CS203 project(s) to your GitHub repository. It should look something like:
    git push -u origin master
  15. Check via the github website to see that your project has been successfully uploaded.