Git Tutorial
- Create account on github.com - see https://help.github.com/
- Also see http://proquest.safaribooksonline.com/9781449367480/ch05_shared_central_github_html
- Login
- Create new repository ‘mytestrepo’ or click on homework link to automatically create your homework repository for the specific assignment
- 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’.
- Upload files to the repository online.
- Checkout the code.
$ git clone https://github.com/YOURID/mytestrepo.git
- Edit / Update a file
$ nano solution.sh
# or some other tool (e.g. emacs, textedit, vi, ...)
- Commit these changes to your LOCAL repository
$ git commit -m "I updated the solution"
- 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
- 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