Tools & releasesHistorical technical note

Bison's collection of solutions to common Git errors

Collects index-lock errors and warnings about Git's default push behaviour, with error screenshots and the configuration commands used at the time. It supports reviewing troubleshooting by error type; inspect the current repository state before applying a command.

Original byline:

Git troubleshooting notes collected by Bison.

English translation of the Chinese original, translated on . The article body uses automated translation; app descriptions, historical reading notes and video subtitles receive separate editorial checks. Original publication dates, attribution, code and version notes are retained.

"I have been using Windows 7 recently, and some tasks require Git. At first, I resisted."

I have been using Windows 7 recently, and some tasks require Git. I resisted at first, but had no choice but to give it a go. Here are some problems I encountered while using Git and how I solved them.

-NO.1: Running git add on a file produces the following error.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.


Solution: rm -f ./.git/index.lock

-NO.2: Running git push produces the following warning.


warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

git config --global push.default simple


Solution: run git config --global push.default matching, then run git push again.

-NO.3 A git commit produces the following error:

fatal: Unable to create ‘project_path/.git/index.lock’: File exists. exists


Solution: rm -f ./.git/index.lock

These are all the issues I have encountered so far. I will update this whenever new ones arise.

Recommended reading: Integrating a Baidu Mobile SSP launch ad in one minute

Copyright © Bison. Please retain a hyperlink to the original article when reproducing it.