Created
May 19, 2020 10:30
-
-
Save sistematico/103f078295fd3d063e9adb00362f4b5c to your computer and use it in GitHub Desktop.
Github automatic clone & pull
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
#!/usr/bin/env bash | |
# | |
# github - Script para receber automaticamente as mudanças feitas no Github | |
# LEMBRE-SE DE CONFIGURAR CORRETAMENTE SEU GIT SEM SENHA!!! | |
# | |
# Desenvolvido por Lucas Saliés Brum <lucas@archlinux.com.br> | |
# | |
# Sugestão de crontab: | |
# * * * * * sh -c "/usr/local/bin/github.sh" > /dev/null 2>&1 | |
# | |
# Criado em: 20/12/2017 19:27:31 | |
# Última Atualização: 04/11/2018 16:17:32 | |
# Diretório base | |
base="/var/www/html/projetos" | |
# Sua conta no github | |
github="git@github.com:usuario" | |
# ou | |
# github="https://github.com/usuario" | |
if [ $1 ]; then | |
repos=("$@") | |
else | |
repos=("repositorio1" "repositorio2") | |
fi | |
for r in "${repos[@]}"; do | |
[ ! -d $base/$r ] && git clone $github/$r $base/$r | |
cd $base/$r | |
git pull -q origin master | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment