GIT默认编辑器配置



在PowerShell中工作,我的主要目标是从合作者中恢复合并。

当我运行git revert -m 1 <SHA of merge>时git返回:

hint: Waiting for your editor to close the file... C:UsersHughemacsbinrunemacs.exe: 
C:UsersHughemacsbinrunemacs.exe: command not found
error: There was a problem with the editor 'C:UsersHughemacsbinrunemacs.exe'.
Please supply the message using either -m or -F option.

我重新启动了我的计算机并重新登上了存储库,但得到了相同的结果。

谷歌搜索后,我决定尝试更改默认编辑器,从emacs到nano并运行:

git config --list

返回的:

core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
core.editor=nano.exe
user.email=hghklly@gmail.com
user.name=Hugh
core.editor=C:UsersHughemacsbinrunemacs.exe
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
remote.origin.url=git@github.com:ucfnmyo/SDC_MuseumsProject.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

您可以看到core.editornano.exe没有文件路径的两个条目,而runemacs.exe的完整文件路径。

我检查了我的本地和全局配置文件,均未指定emacs。

C:/Program Files/Git/mingw64/etc/gitconfig上的配置内容:

[http]
    sslCAInfo = C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
    sslBackend = openssl
[diff "astextplain"]
    textconv = astextplain
[filter "lfs"]
    clean = git-lfs clean -- %f
    smudge = git-lfs smudge -- %f
    process = git-lfs filter-process
    required = true
[credential]
    helper = manager
[core]
    editor = nano.exe

本地配置内容:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
[remote "origin"]
    url = git@github.com:ucfnmyo/SDC_MuseumsProject.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master

C:ProgramData/Git/config上的配置内容:

[core]
    symlinks = false
    autocrlf = true
    fscache = true
[color]
    diff = auto
    status = auto
    branch = auto
    interactive = true
[help]
    format = html
[rebase]
    autosquash = true

我还检查了Windows默认值,对于.txt文件,这是记事本。

(1(如何将emacs作为默认的GIT编辑器或(2(简单地解决此问题的任何建议?

谢谢!

可以配置git的三个地方:

  1. 系统
  2. 全球
  3. 本地

由于您已经检查了全球和本地,因此必须在系统配置中指定EMACS编辑器。

,如果您运行的内容比Windows XP更新,则可以打开此文件以在C:ProgramDataGitconfig上进行编辑。通常,您可以使用诸如git config --edit --system之类的git命令,但是由于您的编辑不同步,因此无法正常工作。

update

列出所有配置文件:git config --list --show-origin

然后,用编辑器手动通过它们并删除重复的属性。

最新更新