**Motivations:**
- Deployment script was blocking at step 5 (Git repository verification)
- Command substitution with SSH could hang indefinitely
- Need to avoid blocking on SSH connection failures
**Root causes:**
- Command substitution \ with ssh_exec could block if SSH connection hangs
- Complex logic with grep on command output was fragile
- No proper timeout handling in the verification step
**Correctifs:**
- Simplified Git repository verification logic
- Removed command substitution that could block
- Use direct exit code checking instead of parsing output
- Improved error handling with explicit SSH exit code checking
- Added cleanup and retry mechanism for connection failures
**Evolutions:**
- More robust Git repository verification that doesn't block
**Pages affectées:**
- deploy.sh: Simplified Git repository verification step
**Motivations:**
- SSH ControlMaster connection errors were causing deployment failures
- Connection reset errors were not handled properly
- No retry mechanism for failed SSH connections
**Root causes:**
- SSH ControlMaster socket could become stale or be closed prematurely
- No validation of connection before use
- No cleanup of dead connections
- Silent failures in conditional checks
**Correctifs:**
- Added connection validation before each SSH command
- Implemented automatic cleanup of dead SSH connections
- Added retry mechanism (up to 3 attempts) with connection cleanup
- Enhanced SSH options for better connection stability (ConnectTimeout, ServerAliveInterval, ServerAliveCountMax)
- Improved error handling in Git repository verification step with explicit error detection and recovery
**Evolutions:**
- Enhanced SSH connection management with robust error handling
- Better error messages to distinguish connection errors from other failures
**Pages affectées:**
- deploy.sh: Enhanced ssh_exec() function, added helper functions, improved error handling
- fixKnowledge/ssh-connection-errors-deployment.md: Documentation of the problem, root cause, and solution