Github and Website Workshop/local repo

From OpenHatch wiki
Revision as of 00:38, 23 February 2015 by imported>Auria (Auria moved page Github and Website Workshop/fork a template to Github and Website Workshop/local repo: no longer forking, so page name doesn't make sense)

Welcome to the the first step of the Github and Website Workshop - finding a template you like and forking it!

Checklist before you begin:

  • Completed setup (Github account, git and text editor on laptop, optional Namecheap domain registered)
  • Have name tag
  • Have two different coloured sticky notes


So what is git/Github?

  • Allows groups of people to work on the same documents (often code) at the same time, and without stepping on each other's toes
Example: Aliah and Erica are working on a website
Aliah just added a link to a funny video. Erica just added a picture of them.
What should the new document look like? Git helps you resolve this.
  • Great for individual projects too - we'll be using it with our code today
    • backs up your files (like DropBox)
    • lets you show your code to other people (and download other people’s code!)
    • can host your website! (stores the files for your website and lets it be accessed from the internet)

Git vs. Github

  • Git: a revision control system, a tool to manage the history of your code (the tool we are learning to use in the terminal today)
  • GitHub: a hosting service for git repositories

Repository: A directory where git has been initialized to start version controlling your files. This repository allows other people can look at your code online and holds what will be on your website


Forking

Content source

Suppose you want to contribute to someone else’s project on Github, or wish to use someone’s project as the starting point for your own. This process is known as forking.

Creating a “fork” is producing a personal copy of someone else’s project. Forks act as a sort of bridge between the original repository and your personal copy. You can submit Pull Requests to help make other people’s projects better by offering your changes up to the original project. Forking is at the core of social coding at GitHub.

For this workshop, we’ll be using a repository that we've already created for you with some basic templates (LINK TO COME).

Picking a Template

Content to come!

Setting up the repository

1. Fork

2. Change the name

  • In your copy of the repository, go to Settings and change the repository name to your_Github_username.github.io.
  • Now you can go to that url and your website will appear!

3. Make a place for the files on your computer

  • Make a folder where you want this project
  • open git shell (which you downloaded in setup) and use the following commands to get to your folder:
    • pwd: prints the current file path e.g. Documents/CS/
    • ls: prints the contents of the current folder
    • cd [folder]: enters the folder

4. Clone the repository

  • "In order to do anything in Git, you have to have a Git repository. This is where Git stores the data for the snapshots you are saving. There are two main ways to get a Git repository. One way is to simply initialize a new one from an existing directory, such as a new project or a project new to source control. The second way is to clone one from a public Git repository, as you would do if you wanted a copy or wanted to work with someone on a project." (source)
  • To clone the existing templates to your new folder, enter the following command: git clone https://github.com/username/username.github.io

Now you can go to your website by typing the URL: username.github.io into your browser