search

Home  >  Q&A  >  body text

When using git, I exited by pressing ctrl+z in the vim editing interface. How do I get back to the editing interface?

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?

黄舟黄舟2787 days ago1026

reply all(6)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-05-02 09:49:20

    Answer on your mobile phone, next time just git commit -am "commit"

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-02 09:49:20

    Kill the process and commit again?

    reply
    0
  • 大家讲道理

    大家讲道理2017-05-02 09:49:20

    Just move the index.lock prompted outside the folder and try again

    reply
    0
  • 世界只因有你

    世界只因有你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.

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-02 09:49:20

    Just delete this file C:/Users/dell/gittest/.git/index.lock

    reply
    0
  • PHPz

    PHPz2017-05-02 09:49:20

    fg

    ...........................................

    reply
    0
  • Cancelreply