Welcome to Challenge 2 Github and Website Workshop - setting a local repository!
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 to look at your code online and holds what will be on your website
Creating the repository
1. Log into Github
2. In the top right corner, click the plus button and select "New repository"
3. Check the option to "Initialize this repository with a README" - this is a text file that explains what your project is. It'll be blank for now, but it's good practice to always have this file.
4. Go to Settings and change the repository name to your_Github_username.github.io.- This will let you go to that url and your website will appear! (nothing will be there yet, though)
Set up the repository locally
1. Make a place for the files on your computer
- Make a folder where you want this project
- open a terminal and use the following commands to get to your folder: (if you're on Windows, open git shell - which you downloaded in setup)
- pwd: prints the current file path e.g. Documents/CS/
- ls: prints the contents of the current folder
- cd [folder]: enters the folder
2. From the terminal, set up this repository in your local machine
- git init
- tells git you want to use it in this folder (creates a repository)
- git remote add origin https://github.com/[your username]/[repo name].git
- A remote repository is a version of your project hosted on the Internet or network somewhere - this lets us edit it from multiple computers
- To work on the repository you just made on Github in the folder on your computer, use the above command