git autopush shell script
script bash para hacer un commit de un repositorio GIT de manera automatizada
- añadir a cron para ejecución automatizada.
- hay que configurar el remote:
- git config credential.helper ← no he hecho funcionar o no aporta
- origin https://<user>:<pass>@<url>
- certificado SSH? ← debería funcionar
#!/usr/bin/env bash cd <git_directory> [[ -z "$(git status --porcelain)" ]] || { git add . FILES_AFFECTED=$(git diff --cached --name-only | sed 's/^/* /') COMMIT_MESSAGE=$(printf "%s\n\nFitxers afectats:\n%s" "$(date +%Y-%m-%d)" "$FILES_AFFECTED") # git commit -m "$(date +%Y-%m-%d)" -m "Fitxers afectats:" -m "$FILES_AFFECTED" git commit -m "$COMMIT_MESSAGE" git push origin master }