Skip to content

Instantly share code, notes, and snippets.

@codigobash
Created November 28, 2017 16:37
Show Gist options
  • Save codigobash/190326dcae59d5d8a8f22f69fb337406 to your computer and use it in GitHub Desktop.
Save codigobash/190326dcae59d5d8a8f22f69fb337406 to your computer and use it in GitHub Desktop.
0. opcional agregar la clave ssh para no estar poniendo usuarios y contraseñas....
1.- crear un repositorio de proyecto
yo lo llame blog
git@github.com:codigobash/blog.git
2.- crear un repositorio de usuario.github.io el cual mi usuario es codigobash quedara como codigobash.github.io
git@github.com:codigobash/codigobash.github.io.git
3. crear el sitio hugo
mkdir blog
cd blog/
hugo new site .
git init
git remote add origin git@github.com:codigobash/blog.git
echo 'public/' > .gitignore
#----------------------------------------opcional cualquier tema
# agregar tema minimal ejemplo
#https://github.com/calintat/minimal
#
$ git submodule add https://github.com/calintat/minimal.git themes/minimal
$ git submodule init
$ git submodule update
#----------------------------------------
3. crear un submodulo dentro del proyecto para usuario.github.io
git submodule add -b master git@github.com:codigobash/codigobash.github.io.git public
git init
git update
4. mandar los archivos al proyecto
git add .
git commit -m 'inicio de blog'
git push -u origin master
----------------generar sitio con script--------------
hugo
cd public
git add .
git commmit -m 'inicio del blog'
git push
rm -rf !(.nojekyll|.git)
de ahora en adelante puedes usar este pequeño script , o puedes hacero paso por paso, editalo a tu gusto.
dale permisos con
chmod +x up.sh
ejecutalo dentro del proyecto con
./up.sh "comentario inicial'
# script----------------------------------------------------------------------------
#!/bin/bash
# inicio del script
echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
# Build the project.
hugo # if using a theme, replace by `hugo -t <yourtheme>`
# Go To Public folder
cd public
# Add changes to git.
git add -A
# Commit changes.
msg="rebuilding site `date`"
if [ $# -eq 1 ]
then msg="$1"
fi
git commit -m "$msg"
# Push source and build repos.
git push origin master
# remove all docs except git
rm -rf !(.nojekyll|.git)
# Come Back
cd ..
# fin del script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment