Trabajando en ciertos sitios donde son exigentes con respecto a las reglas de Git y Bitbucket en como firmas los commits, a veces configuramos mal el nombre y el correo con el que se firma en git, para eso este snippet te puede ayudar corregir el problema, actualiza tanto el author como el comitter(caso cuando haces cherry-pick):
git filter-branch --env-filter '
if [ "$GIT_AUTHOR_EMAIL" = "tucorreo@dominio.com" ]; then
export GIT_AUTHOR_NAME="Tu Nombre"
export GIT_AUTHOR_EMAIL="tucorreo@dominio.com"
fi
if [ "$GIT_COMMITTER_EMAIL" = "tucorreo@dominio.com" ]; then
export GIT_COMMITTER_NAME="Tu Nombre"
export GIT_COMMITTER_EMAIL="tucorreo@dominio.com"
fi
' --tag-name-filter cat -- --branches --tags
Eso reparará el issue que bloquea hacer push al repositorio remoto como este:
Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 12 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 1.44 KiB | 1.44 MiB/s, done.
Total 6 (delta 3), reused 1 (delta 0), pack-reused 0
remote:
remote: Control Freak - Commit bc8dc08a8d02428b rejected: bad author metadata.
remote: -----
remote: Author "Luis Alamo <tucorreo@dominio.com>" does not exactly match
remote: a Bitbucket user record. The closest match is:
remote:
remote: "Tu Nombre <tucorreo@dominio.com>"
remote:
remote: To see the bad commit's metadata:
remote:
remote: git show -s --pretty=fuller bc8dc08a8d02428b2560a70eb4d6d5
remote:
remote: Please have a Bitbucket admin edit the corresponding user record
remote: so it matches your settings. Alternatively, adjust your own config
remote: and adjust the problematic commit(s).
remote: Like so:
remote:
remote: git config --global user.name "Tu Nombre"
remote: git config --global user.email tucorreo@dominio.com
remote: git commit --amend --reset-author
remote:
remote: Adjusting author metadata in older commits is difficult.
remote: Detailed instructions here: https://bit-booster.com/author.html
Nota: Este comando reescribe completamente el historial de Git, lo que puede ser problemático si otras personas ya tienen copias del repositorio, ya que cambiará todos los hashes de commit.
Espero sea de ayuda para la posteridad
Top comments (0)