Git Tutorial

  1. Create account on github.com - see https://help.github.com/
  2. Login
  3. Create new repository ‘mytestrepo’ or click on homework link to automatically create your homework repository for the specific assignment
  4. Add a README.md file. This ends in ‘md’ because we usually write these in markdown which is a structured text format that can be rendered in nice ways in HTML and PDF (like this guide). You can also make it a plain text file and use ‘.txt’.
  5. Upload files to the repository online.
  6. Checkout the code.
$ git clone https://github.com/YOURID/mytestrepo.git
  1. Edit / Update a file
$ nano solution.sh
# or some other tool (e.g. emacs, textedit, vi, ...)
  1. Commit these changes to your LOCAL repository
$ git commit -m "I updated the solution"
  1. Save this changed repository in the github server. (eg ‘the cloud’). This lets others see the file changes and sync their repository with yours if you are doing a collaborative project or for the instructor to see your submitted solutions. Also saves a copy, you or others can then checkout a clone of this repository on other computers or even just different folders if you need to
$ git push
# git push will request your github ID and github password
  1. Add another new file (e.g. another script)
$ nano newfile.py
$ git add newfile.py
$ git commit -m "I added this new file" newfile.py
$ git push