Build Your Own Website with Github Pages and Cloud9
Women Who Code DC
Front End Hack Night
Alexandra Ulsh
alexandraulsh.com
@AlexUlsh
Women Who Code DC Front End Hack Night (FEHN) Lead
InfoSec @ Mapbox
After tonight, you will be able to use Git, Github Pages, and Cloud9 IDE to host your own website!
Open = Free, available, public, transparent
Source = software source code
Public software projects on GitHub are open source.
Opposite of commercial proprietary software.
A software program that helps you write software.
Distributed version control for source code
Distributed = more than one copy on more than one computer
Created in 2005 by Linus Torvalds (Linux kernel).
A website that hosts public and private Git repositories
Repository = a project or set of files
"Social coding"
Created in 2008
Public
Uses specially named repositories
User pages = http://username.github.io/
Organization pages = http://organization.github.io/
Project pages = http://username.github.io/my-cool-project
Unless you use Jekyll!
Free cloud-based integrated development environment (IDE)
Each workspace is its own Ubuntu Docker container
Support for 40+ programming languages
Best way to code on a Chromebook
Women are encouraged to not self-promote...
Let's change that by building a personal website!
https://github.com/
username.github.io
.md = Markdown
"Text-to-HTML conversion tool"
GitHub Flavored Markdown
You can use Emojis!
https://c9.io/
GUI = Graphical User Interface
# Create a new file
touch index.html
Why learn bash? Because it saves time
Builds command line interface (CLI) skills
CLIs used in SASS, bower, Node.js, and Ruby
The Terminal
# Create a new file
touch index.html
# Create a new directory (folder)
# mkdir = "Make directory"
mkdir css
# Change the current directory
# cd = "Change directory"
cd css
# Create CSS stylesheet
touch styles.css
# Open file in Cloud9
c9 index.html
# Where am I? What's my working directory?
# pwd = "Print working directory"
pwd
# returns /home/ubuntu/workspace/css
# List files in current directory
# ls = "list"
ls
# returns styles.css
# Go back a directory (to the parent)
cd ..
# Go back two directories
cd ../..
# Clear all text in the terminal
clear
# Remove a file
# rm = "Remove"
rm styles.css
# Remove a directory containing files
# -r = "Recursive"
rm -r css
# Delete empty directory
# rmdir = "Remove directory"
rmdir js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My Personal Website</title>
<link href="css/styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container">
<h1>My Personal Website</h1>
<p>Here's a puppy</p>
<img src="img/Dougie-the-Shih-Tzu.jpg">
</div>
</body>
</html>
Different URL
git status
# Add one file
git add index.html
# Add all current untracked files
git add --all
# Commit changes to the local working directory
# -m = "Message"
git commit -m "My first commit"
git commit
What is this?
Type your commit message
To save type ctrl + o then enter
After saving, type ctrl + x to exit
Type the letter a
Type your commit message
Type esc then :w to save
To exit, type :q
May have to type esc again before
Type the letter a
Type your commit message
Type esc then :w to save
To exit, type :q
May have to type esc again before
# Push changes to GitHub repository on the master branch
git push origin master
# Get information about remote servers
git remote -v
origin = default name for connection to Github
Github = remote server, or "remote"
repository = https://github.com/techladyulsh/techladyulsh.github.io
Branches allow us to safely isolate changes or work on multiple features in parallel
# Get a list of branches
git branch
# Create a new branch
git branch css
# Switch to the new branch
git checkout css
# Shortcut - create and switch to new branch
git checkout -b css
# Add modified styles.css to tracked files in CSS branch
git add --all
# Commit changes to CSS branch
git commit -m "Set default font family to Sans Serif"
# Push changes to CSS branch on Github
# NOTE we are pushing to "origin css" not "origin master"
git push origin css
We need to merge our changes in the css branch with the master branch.
# Check out the master branch
git checkout master
# Merge the CSS branch with the master branch
git merge css
# Push changes from merge back to master branch on Github
git push origin master
# Delete the remote branch on Github
git push origin --delete css
# Delete the local branch
# -d = "Delete"
git branch -d css
# View available branches
git branch
If an update is not showing on your site despite pushing the changes to GitHub, open up your browser's developer tools and disable caching.
Google Chrome Developer Tools
Windows/Linux/Chromebook = Ctrl + Shift + J
Mac OS X = Cmd + Opt + i
Make sure "Disable cache" is checked, then refresh the page.
These use the gh-pages branch of any repository, as long as you have already created a User Pages repository.
# Create the gh-pages branch
git branch gh-pages
# Checkout the gh-pages branch
git checkout gh-pages
# Push the gh-pages branch to GitHub
git push origin gh-pages
http://techladyulsh.github.io/My-Sample-Project
NOTE: Project Pages URLs are case sensitive!
Allows certain files, file extensions, and folders to be excluded from your Git repository.
Particularly useful for Node.js applications.
To enable in Cloud9, show hidden files.
Sometimes may have to add the hidden .c9 folder to a .gitignore file.
Get notifications of any new pull requests or issues.
I used namecheap
CNAME = canonical name
DNS (Domain Name System) record
Points an alias (domain name), to another domain name (canonical name).
For example, alexandraulsh.com is the alias for alulsh.github.io.
CNAME file does not have a file extension.
Domain name needs to point to Github's servers.
Check out Search Engine Optimization (SEO), Google Analytics, and Jekyll.
Check out some personal websites of awesome women and non-binary people in the DC Tech scene.