SXXXXXXX_GitUtility/GIT errori - annotazione.md
2025-07-29 08:41:44 +02:00

105 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### ERRORE:
```
C:\src\PJ33714_GRIFO_E\S1002725_PSM\S1002725_PSM>git push
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 337 bytes | 337.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Commit found with wrong committer name for 5895c59 (initial commit)
remote: Should have been committer 'VALLONGOL (VALLONGOL)', was 'Luca Vallongo'
remote: error: hook declined to update refs/heads/master
To https://gitled.leonardocompany.com/git/ELEITA/Software/PJ33714_GRIFO_E/S1002725_PSM.git
! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'https://gitled.leonardocompany.com/git/ELEITA/Software/PJ33714_GRIFO_E/S1002725_PSM.git'
```
### SOLUZIONE: ❌ **Errore: Commit found with wrong committer name**
```
remote: Should have been committer 'VALLONGOL (VALLONGOL)', was 'Luca Vallongo'
remote: error: hook declined to update refs/heads/master
```
### 📌 **Cosa significa**
Il repository Git aziendale ha un **hook server-side** che **verifica che l'autore e il committer siano identificati in modo corretto**, probabilmente per **tracciabilità interna o policy aziendali**.
In particolare, si aspetta che il nome e/o l'email del committer siano esattamente:
```
VALLONGOL (VALLONGOL)
```
Ma nel tuo commit risultano come:
```
Luca Vallongo
```
---
### ✅ **Soluzione: Configura il tuo Git locale con il nome e l'email richiesti**
Devi configurare il tuo Git locale per usare le **informazioni corrette** per `user.name` e `user.email`.
#### 1. Verifica la configurazione attuale:
```bash
git config user.name
git config user.email
```
#### 2. Aggiorna con il nome richiesto (probabilmente questo):
```bash
git config user.name "VALLONGOL"
git config user.email "VALLONGOL@leonardocompany.com"
```
> *Usa lemail esatta che lazienda si aspetta. Se non sei sicuro, controlla su un commit valido oppure chiedi allamministratore Git.*
---
### 🔁 **Ora correggi il commit che hai già fatto**
Hai già fatto il commit con il nome sbagliato, quindi devi **riscriverlo**.
Se è **solo l'ultimo commit** che hai fatto, usa:
```bash
git commit --amend --reset-author
```
Questo riapre il commit e imposta autore e committer con quelli corretti dalla nuova configurazione Git.
Poi riprova:
```bash
git push origin master
```
---
### 🧼 Se sono più commit sbagliati
Se hai fatto più commit con autore errato:
```bash
git rebase -i origin/master
# (modifica i commit da riscrivere, poi per ognuno usa git commit --amend --reset-author)
```
---
### 💡 Tip finale
Per rendere questa configurazione persistente anche in altri repo:
```bash
git config --global user.name "VALLONGOL"
git config --global user.email "VALLONGOL@leonardocompany.com"
```