2011-12-17 22 views
2

我使用的是Ubuntu bash。当我输入git checkout然后按tab,我预计它会显示新的分支,但我得到:Git结帐无法使用bash自动完成

git checkout 
bash: eval: line 345: unexpected EOF while looking for matching `'' 
bash: eval: line 346: syntax error: unexpected end of file 

我用Google搜索,但一无所获。而且bash甚至不会告诉我line 345在哪里。任何人都知道什么是错的?

编辑

当我set -x来砸然后git checkout [tab],输出:

+++ case "$c$2" in 
+++ printf '%s 
' 'feature/capybara ' 
+++ for c in '$1' 
+++ case "$c$2" in 
+++ printf '%s 
' 'feature/chinese-search ' 
+++ for c in '$1' 
+++ case "$c$2" in 
+++ printf '%s 
' 'feature/comment_validation ' 
+++ for c in '$1' 
+++ case "$c$2" in 
+++ printf '%s 
' 'feature/comments ' 

...等等。没有错误。但我仍然无法正常使用自动完成功能。

+0

您运行的是哪个版本的ubuntu? – willoller 2011-12-17 03:54:31

+5

该行是对git-completion.bash的引用。在你的系统上找到它,看看第345行的样子。 – jasonmclose 2011-12-21 02:43:32

回答

1

尝试set -x在bash:

-x Print commands and their arguments as they are executed. 

这应该告诉你什么是代码失败,因为它会表现出什么样的工作的bash完成确实在后台运行。