Using git on Windows, when running the git commit -a
command, I entered the vim editing interface. At this time, I accidentally pressed ctrl z to exit the vim editing interface, returned to the command line, and displayed this information:
$ git commit -a
Vim: 读错误,退出中...
Vim: Finished.
If you run git commit -a
again at this time, the following message will appear:
$ git commit -a //ctrl+z退出之后再次运行git commit -a
fatal: Unable to create 'C:/Users/dell/gittest/.git/index.lock': File exists.
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.
Try fg
to go back, but it doesn’t work. The following message is displayed:
$ fg
bash: fg: current: no such job
What should I do?
世界只因有你2017-05-02 09:49:20
Vim: 读错误,退出中...
Vim: Finished.
Very strange. (But considering it’s Windows, I’m relieved.)
Your Ctrl-Z does not put Vim in the background like on UNIX systems, but causes Vim to exit with an error, so fg naturally does not work.
You can delete the lock file by following the prompts in the second code block.
Don’t press Ctrl-Z casually in the future. You only said "use git on windows". I don't know which version of git you are using (the official version of git is based on msys; Cygwin has its own git and Vim; msys2 also has one; of course WSL also has a set...). In addition, you may be mixing different versions of bash and Vim, such as using the Windows native version of Vim in a Cygwin environment.