Aquesta és una revisió antiga del document


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="$(date +%Y-%m-%d)\n\nFicheros afectados:\n$FILES_AFFECTED"
 
    git commit -m "$(date +%Y-%m-%d)" -m "Fitxers affectats:" -m "$FILES_AFFECTED"
 
    git push origin master
}
  • tech/git/autopush.1777902779.txt.gz
  • Darrera modificació: 04/05/2026 06:52
  • per mate