如何更改Git的默认编辑器 [英] How to Change the Default Editor for Git

查看:654
本文介绍了如何更改Git的默认编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在一个月前开始使用git。它为我使用TextMate作为提交的默认编辑器。不过,我想将默认值切换到我已经安装的TextWrangler。我环顾四周,找到了一行代码输入终端来执行此操作。所以我打开终端并输入:

$ $ $ $ $ $ $ $ $ $ $ cd $ $ $ $ $ b $ cd $全局core.editor TextWrangler
git状态
git add。
git commit //然后错误出现

错误说:
错误:无法运行TextWrangler:没有这样的文件或目录
错误:编辑器的TextWrangler出现问题。
请使用-m或-F选项提供消息。



我不知道这意味着什么或者我做错了什么。我相信它是一个明显的错误,但任何人都可以解释如何解决这个问题?

解决方案

刚刚回答我自己的问题,帮助以上的评论......要切换到TextWrangler作为Git的默认值,您必须打开TextWrangler,在工具栏中单击TextWrangler并从下拉列表中选择安装命令行工具。然后进入命令行并输入:

  git config --global core.editoredit -w

编辑是在命令行中理解的命令,意思是打开一个textWrangler文件。

I just started using git about a month ago. It was set up for me using TextMate as my default editor for commits. However, I'd like to switch the default to TextWrangler which I already have installed. I looked around online and found a line of code to type into the terminal to do this. So I opened the terminal and typed:

cd Desktop
cd "projectName"
git config --global core.editor TextWrangler
git status
git add.
git commit  //then the error comes up

The error says: error: cannot run TextWrangler: No such file or directory error: There was a problem with the editor 'TextWrangler'. Please supply the message using either -m or -F option.

I don't know what this means or what I am doing wrong. I am sure its an obvious mistake, but can anyone explain how to fix this?

解决方案

Just answered my own question with the help of the above comments... to switch to TextWrangler as the default for Git, you must open TextWrangler, click on TextWrangler in the tool bar and select "install command line tools" from the drop down. Then go into command line and type:

git config --global core.editor "edit -w"

Edit is the command that is understood in the command line which means to open a textWrangler file.

这篇关于如何更改Git的默认编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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