Last active
August 29, 2015 14:00
-
-
Save ssaunier/11346846 to your computer and use it in GitHub Desktop.
Quickly create a Github Pages repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# What is your GitHub username? & your project name? Change with your own | |
GITHUB_USERNAME="ssaunier" | |
PROJECT_NAME="minesweep" | |
# We can create GitHub repo from the terminal, with https://github.com/github/hub | |
# It's really convinient. You can download it with: | |
brew install hub | |
# Say you want to work on a minesweep, create the repo: | |
mkdir -p ~/code/$GITHUB_USERNAME/$PROJECT_NAME && cd $_ | |
# Initialize the git repo and change the branch to gh-pages right away | |
git init | |
git checkout -b gh-pages | |
# Create the GitHub repo. At first usage, it will prompt you for your credentials | |
hub create | |
# We will notify GitHub Pages that this is not a Jekyll repo | |
touch .nojekyll | |
echo "Hello world" > index.html | |
git add . | |
git commit -m "This is not a Jekyll repo" | |
git push -u origin gh-pages | |
# You can visualize the GitHub repo with: | |
hub browse | |
# Wait a few minutes, and you should see "Hello world" at: | |
open http://$GITHUB_USERNAME.github.io/$PROJECT_NAME | |
# Of course, you can set it to answer to a specific CNAME (Then it would drop the | |
# project name automatically after the slash) | |
echo "$PROJECT_NAME.saunier.me" > CNAME # Change with your own URL | |
git add CNAME | |
git commit -m "Adding CNAME" | |
git push origin gh-pages | |
# Now go to OVH / Gandi / your DNS provider and record a CNAME from | |
# "$PROJECT_NAME" to "$GITHUB_USERNAME.github.io." (trailing dot is *SO* important) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment