How to Fix Git Detached HEAD and Checkout a Branch - How to Fix 'Git Remote Origin Already Exists' Error When Cloning-Resolve index.lock Exists in Git on Linux

Final checklist
- Confirm that the same symptom is gone after a restart or refresh.
- Keep the smallest working change and undo temporary diagnostic settings.