麻烦设置git'core.editor' [英] Trouble on setting the git 'core.editor'

查看:192
本文介绍了麻烦设置git'core.editor'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的Mac OS Snow Leopard 10.6.7上设置git,但是我做了一些错误......



此时,我有以下警告

  $ git config --global core.editor 
EDITOR = / usr / bin / vim
错误:关键字core.editor有多个值:mate
$ git config --global core.editor open
warning: core.editor有多个值

我该如何解决这个问题?而且,大多数情况下,我怎样才能将 core.editor 设置为TextEdit并使其工作?



PS:I已经阅读

最简单的方法是将环境变量EDITOR更改为指向队友。在您的 .bash_profile 中添加以下内容:

  export EDITOR =/ usr / local / bin / mate -w

并重新启动您的终端会话,或者源代码 .bash_profile



至于你的错误信息:

 错误:关键的core.editor有多个值:mate 

这意味着您已经在.gitconfig中添加了多个core.editor行。



使用mate 〜/ .gitconfig 修改你的 .gitconfig 并删除多余的行,或者如果你不介意不使用它们,请使用:

  git config --global --unset-all core.editor 

然后使用

  git config --global --add core.editor/ usr / local / bin / mate -w

然后您可以离开 $ EDITOR mate c c设置为之前设置的值。
$ b / code>不在 / usr / local / bin 中找到它的第一个地方是使用 type mate (在bash中,不知道其他shell)




由于您要使用打开作为你的 $ GIT_EDITOR 你需要以下内容:

  -W导致打开,等待其打开的应用程序(或已打开的应用程序)退出。与-n标志一起使用,允许open作为$ EDITOR环境变量的适当应用程序。 

-n即使已经运行了应用程序,也可以打开一个新的应用程序实例。

这将适用于:

  git config --global --unset-all core.editor 
git config --global --add core.editoropen -W -n
code>


I am trying to set git on my Mac Os Snow Leopard 10.6.7 but I made some errors on doing that...

At this time I have the following warning:

$ git config --global core.editor
EDITOR=/usr/bin/vim
error: More than one value for the key core.editor: mate
$ git config --global core.editor open
warning: core.editor has multiple values

How can I solve that? And, mostly, how can I set the core.editor to TextEdit and make it works?

P.S.: I already read this question.

解决方案

The easiest way is to change the environment variable EDITOR to point to mate. In your .bash_profile add the following:

export EDITOR="/usr/local/bin/mate -w"

and re-start your terminal session, or source the .bash_profile.

As for your error message:

error: More than one value for the key core.editor: mate

it means you've added multiple core.editor lines in your .gitconfig.

Use mate ~/.gitconfig to modify your .gitconfig and remove the extra lines, or if you don't mind unsetting all of them use:

git config --global --unset-all core.editor

Then use

git config --global --add core.editor "/usr/local/bin/mate -w"

then you can leave $EDITOR set to what it was previously set to.


If mate is not located in /usr/local/bin find where it is first by using type mate (in bash, not sure about other shells)


Since you want to use open as your $GIT_EDITOR you will need the following:

-W  Causes open to wait until the applications it opens (or that were already open) have exited.  Use with the -n flag to allow open to function as an appropriate app for the $EDITOR environment variable.

-n  Open a new instance of the application(s) even if one is already running.

This will work for that:

 git config --global --unset-all core.editor
 git config --global --add core.editor "open -W -n"

这篇关于麻烦设置git'core.editor'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆