Last active
February 6, 2024 22:57
-
-
Save vlucas/1a155a9b5ece5eb36d54 to your computer and use it in GitHub Desktop.
Deploy a Static Site to Github Pages
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
#!/bin/bash | |
GIT_REPO_URL=$(git config --get remote.origin.url) | |
mkdir .deploy | |
cp -R ./* .deploy | |
cd .deploy | |
git init . | |
git remote add github $GIT_REPO_URL | |
git checkout -b gh-pages | |
git add . | |
git commit -am "Static site deploy" | |
git push github gh-pages --force | |
cd .. | |
rm -rf .deploy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Assumptions:
What this script does:
.deploy
folder (with a dot first so it won't get picked up by thecp
command).deploy
folder and goes to that folder.deploy
folder, and sets the URL to the Git repo URLgh-pages
branchgh-pages
branch with a force deploy.deploy
folderHow to run this:
cd /folder/with/my/website ./deploy.sh