Open Source Comes to Campus/Curriculum/Git/Students
 Make sure you have git set up
This can be done by typing the following into your console:
If your computer doesn't have git, then follow the laptop setup guide by going to your event's home page (e.g. http://ccsf.openhatch.org/ ) and then looking for the laptop setup guide.
 Visiting the project on the web
Since this project is a website, we've specially configured the repository so that whenever there is a push to it, it is made visible on the web.
If your group's repository is called e.g. waffle-castle.github.io, then you can see that the shared version is visible on the web at http://waffle-castle.github.io/. (This is just an example. Your group's repository name should be "schoolname-#.github.io" and its shared page should be at http://schoolname-#.github.io (for example, http://princeton-1.github.io or http://princeton-2.github.io.))
But note that any changes in your fork (your personal copy of the repo) won't show up there until the maintainer of the project merges those changes in.
 Find a task
Now, find a bug on the project's issue tracker that you will work on, and claim it by leaving a comment on the issue saying so.
(Before you do that, make sure to refresh the page and check that no one else has claimed it while you were reading and deciding.)
 To fork a project on Github
- Start out logged in to Github
- Visit the project you want to fork
- Click the "Fork" button in the top-right
- Wait for the animation to conclude
- Notice that your browser is now visiting a copy of the project in your personal space, rather than the old, group-owned one. You should also see a "forked from..." remark in the top-left.
 Now, clone to it to your computer
- On the right side, look for the clone URL directly under the settings button.
- Copy that to the clipboard
- Open a terminal (Git Bash or the Command Prompt if you're using Windows) and navigate to the directory you wish to clone to
- Once you're at the direction, type into the terminal:
"git clone "(including the spaces, but not including the quotation marks)
- Use your terminal to "paste" the URL in. (Make sure it starts with
https; if not, you'll need to use an ssh key and most students probably won't have a key already set up)
- Terminal should now look something like this:
git clone https://github.com/<rest of clone url>
- Press enter to do the "
git clone" operation.
- Once you've done that, "
cd" into the directory.
 Make sure you have the project properly set up
- Open index.html in your favorite text editor -- it should look like a regular HTML page
- Open index.html in your favorite web browser -- it should render basically the same as http://purdue.openhatch.org/
- Make a test change in index.html, save, and reload in the browser. Make sure what you see in the the browser reflects that change.
- Undo that change, with your editor, save, and then reload in the browser. Make sure what you see in the browser reflects that change.
 Resolve the task
How you do this depends on the issue you've chosen. If you run into a problem you can't seem to solve, try asking the student next to you or one of the mentors.
Make sure to open up index.html and check that your solution works.
 Commit and push
Make sure you're in the directory you cloned the git repository to, with a command like:
Once you're finished making changes, you can use the following command to get a list of files you've changed:
You can commit your changes by typing "git add" followed by the files you've changed, for instance:
git add index.html
Once you've added the changes, you can "commit" them with a message specifying what you've changed.
git commit -m "Explanation of my changes"
Now, publish those changes on Github by typing:
You will be prompted for your username and password. (If you find constantly entering your username and password annoying, there's an alternate method we can show you called SSH.)
(Alternatively, you may be prompted to set your name and email address. This means you missed a step in setting up git. No worries, you can set them now.)
You can now visit Github and make sure your personal fork contains those changes.
 Create pull request
Visit your personal fork and click the "Pull requests" button on the right. This will offer you the chance to make a new pull request by clicking on "New pull request". Explain what you did, and make sure to include a comment stating which issues it addresses, so that it automatically closes the issue. (You can see here for details on how to do that.)
Now, get feedback from the project's maintainer (the mentor leading your group) and eagerly await your pull request getting merged!
 Once merged, visit your changes on the web
When your changes are merged into the main project repository, our specially configured repository will update the group website with the merged files.
This is a special trick that we do during the Website editing with git exercise, using Github Pages. It demonstrates that when the merge happens, it can programmatically cause a different event; this is often called hooks.
Sometimes your changes will not show because of caching. To get around this problem, add "/?" to the end of the url.