首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >git使用sh吗?如果是这样,可以更改为使用bash吗?

git使用sh吗?如果是这样,可以更改为使用bash吗?
EN

Stack Overflow用户
提问于 2013-12-20 11:39:49
回答 1查看 1.4K关注 0票数 0

当我运行git命令时,我经常会得到

代码语言:javascript
复制
sh: line 0: igncr: invalid option name

作为输出。这是由我必须让赛根可以忍受的环境造成的。看起来,git正在生成一个sh进程来运行。我是否可以将其配置为bash而不是bash?

它并没有添加太多内容,但是按照请求,这里是git命令

代码语言:javascript
复制
gt ad -p A/B/C.csproj

导致失败的shell命令包括

代码语言:javascript
复制
export SHELLOPTS
set -o igncr

如果与GIT_TRACE=1一起运行

代码语言:javascript
复制
trace: exec: 'git-ad' '-p' 'A/B/C.csproj'
trace: run_command: 'git-ad' '-p' 'A/B/C.csproj'
trace: alias expansion: ad => 'add'
trace: built-in: git 'add' '-p' 'A/B/C.csproj'
trace: run_command: 'add--interactive' '--patch' '--' 'A/B/C.csproj'
trace: exec: 'git-add--interactive' '--patch' '--' 'A/B/C.csproj'
trace: run_command: 'git-add--interactive' '--patch' '--' 'A/B/C.csproj'
trace: built-in: git 'rev-parse' '--show-prefix'
trace: built-in: git 'config' '--get-colorbool' 'color.interactive' 'false'
trace: built-in: git 'config' '--get-color' 'color.interactive.prompt' 'bold blu                      e'
trace: built-in: git 'config' '--get-color' 'color.interactive.header' 'bold'
trace: built-in: git 'config' '--get-color' 'color.interactive.help' 'red bold'
trace: built-in: git 'config' '--get' 'color.interactive.help'
trace: built-in: git 'config' '--get-color' 'color.interactive.error' 'red bold'
trace: built-in: git 'config' '--get-colorbool' 'color.diff' 'false'
trace: built-in: git 'config' '--get-color' 'color.diff.frag' 'cyan'
trace: built-in: git 'config' '--get-color' 'color.diff.plain' ''
trace: built-in: git 'config' '--get-color' 'color.diff.old' 'red'
trace: built-in: git 'config' '--get-color' 'color.diff.new' 'green'
trace: built-in: git 'config' '--get-color' '' 'reset'
trace: built-in: git 'config' '--bool' '--get' 'interactive.singlekey'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'update-index' '--refresh'
trace: built-in: git 'ls-files' '--' 'A/B/C.csproj'
sh: line 0: igncr: invalid option name
trace: built-in: git 'diff-index' '--cached' '--numstat' '--summary' 'HEAD' '--' 'A/B/C.csproj'
trace: built-in: git 'diff-files' '--numstat' '--summary' '--raw' '--' 'A/B/C.csproj'
trace: built-in: git 'diff-files' '-p' '--' 'A/B/C.csproj'
trace: built-in: git 'diff-files' '-p' '--color' '--' 'A/B/C.csproj'
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-12-20 11:46:50

请运行以GIT_TRACE=1为前缀的失败的git命令,以查看生成的失败shell命令的详细信息,并从中获取它.

编辑:在看到跟踪之后,鉴于igncr是一个cygwin特定的bash选项,考虑添加bash函数来覆盖gt命令并关闭该shell选项。

例如,

代码语言:javascript
复制
gt () { (set +o igncr; git "$@";) }
gt ls-files

当然,您应该将gt函数移动到.bashrc或类似的位置。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20702846

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档