Git : Another git process seems to be running in this repository
Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
Terminer processus git et supprimer .git/index.lock :
Windows powershell :
# Se placer à la racine du dépôt Git
$root = (git rev-parse --show-toplevel).Trim()
Set-Location $root
# Vérifier s'il y a des processus git actifs
$gitProcs = Get-Process -Name git* -ErrorAction SilentlyContinue
if ($gitProcs) {
Write-Output "Processus git actifs trouvés : " ; $gitProcs | Format-Table Id, ProcessName
Write-Output "Arrêtez-les avant de supprimer .git\index.lock"
return
}
# Supprimer le fichier de lock (chemin relatif depuis la racine du dépôt)
if (Test-Path ".git\index.lock") {
Remove-Item -LiteralPath ".git\index.lock" -Force
Write-Output ".git\index.lock supprimé"
} else {
Write-Output "Aucun fichier .git\index.lock trouvé"
}
# Vérifier l'état Git
git status
Linux Bash terminal :
# Aller à la racine du dépôt
cd "$(git rev-parse --show-toplevel)"
# Lister processus git (moderne)
pgrep -af git
# Si aucun processus git pour l'utilisateur courant, supprimer le lock
if ! pgrep -u "$USER" -f git >/dev/null; then
if [ -f .git/index.lock ]; then
rm -f .git/index.lock && echo ".git/index.lock supprimé"
else
echo "Aucun .git/index.lock trouvé"
fi
else
echo "Des processus git sont actifs — terminez-les d'abord"
fi
# Vérifier
git status
Member discussion