Intro to GitHub (Activity)

From Foss2Serve
Revision as of 15:53, 18 February 2013 by Heidi.ellis (Talk | contribs)
Jump to: navigation, search


Git Warm-Up



This activity will help you get started with Git. You will work on a remote repository shared by other workshop attendees.

Source Detailed FOSS Field Trip
Prerequisite Knowledge A rudimentary understanding of command-line usage would be helpful, but not required.
Estimated Time to Completion 30-60 minutes
Learning Objectives Upon completion, you will be able to
  • Install Git.
  • Configure Git.
  • Clone a remote repository.
  • Make changes to a local copy.
  • Commit changes to a local copy.
  • Push changes to a remote repository.
  • Access to Internet/Web and web browser
  • Computer with install privilege <Not sure what this is or how to get it.>
  • A password from facilitator to access repository
  • (For facilitator) a server with a git repository
Additional Information
  • Git website:
  • Repository location:
Rights Licensed CC BY-SA (?)
Turn In New git repository with your name containing all changes.

Background contains 4 introductory videos that will help give the participant some context: e.g., what is version control?, what is git?, what is git good for?, etc. Each is between 5-10 minutes.

Getting Help

$ git help
  • The git status command gives useful suggestions. Use often.
$ git status

Commands to Inspect Your Repository

While you are completing the activities below, the following commands may come in handy. These commands do not change the state of your repository so they are always safe to use. Use them often.

  • Status command: reports status of repository and gives suggestions!
$ git status
  • Log command: reports history of commits.
$ git log
  • Diff command: displays detailed differences since last commit.
$ git diff


Part 1: Install and Configure Git

1. Download and install Git for your operating system from 2. Start a shell/terminal (windows: right-click desktop and select 'Git Bash') 3. Configure Git with your identity (replace caps with your information):

$ git config --global 'YOUR NAME'
$ git config --global 'YOUR@EMAIL'

Part 2: Roll-Call Activity

1. Clone the following repository to your local system (password needed).

$ git clone

2. Change into the sandbox directory.

$ cd sandbox

3. Using any tools you like, inside the sandbox directory create a file named YOUR_NAME.txt (e.g., jane_smith.txt). with your bio. Using your favorite text editor, write your bio in the file (don't forget to save). 4. Select the changes you want to commit: your new file. (The following command should be issued in the sandbox directory. So if you have changed directories since step 2, please return to the sandbox directory before issuing the following command.)

$ git add stoney_jackson.txt

5. Commit selected changes to your local repository.

$ git commit -m'Added bio for Stoney Jackson.'

6. Push changes from your local repository to the remote repository (password needed).

$ git push

If git reports something like the following, you may continue to part 3:

Counting objects: 5, done.
Writing objects: 100% (3/3), 245 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To /Users/Stoney/Desktop/t/a.git/
  5dd2c29..7232044  master -> master

If git reports something like the following, continue to the next step:

To ...
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '...'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

7. Pull changes from remote into your local repository. (This may invoke a text editor requesting a message explaining the necessity of the merge. Just save the default message and exit the editor.)

$ git pull

Return to step 6, and try to push your changes again.

Part 3: Follow up

Congratulations, you have successfully contributed to a shared, remote repository!

Additional activities to give you more practice with Git.

  • Issue a pull command every couple of days, and see if anyone else has posted a bio, or updated an existing bio.
  • Update your bio. Follow steps 6-11 as necessary to commit your changes to your local repository and then push them to the shared, remote repository.
  • Delete your local repository and clone a new one. Confirm your changes have persisted.
  • Add a subdirectory with your name as its name, and add some new files inside.


URL to module or material


Description of original source and/or link if present.


Use Computing Ontology or ACM Classification System if possible

Education Level



Educator or Learner (both)


person who posts the activity






TBD - probably CC BY 3.0




Stoney Jackson

Date Created


Date Last Modified


Personal tools
Learning Resources
HFOSS Projects