Git: fatal: protocol error: bad line length character: ?]0;

Git: fatal: protocol error: bad line length character: ?]0;

这个问题几乎与 another 相同,但是解决方案无效。

首先,让我向您展示所有我能想到的可能相关的内容:

$ unalias ssh git  # Just making sure

$ unset git ssh    # Making really, really sure

$ which ssh
/usr/bin/ssh

$ which git
/usr/bin/git

$ cat ~/.bashrc
# super minimal!
case $- in
  *i*) ;;
    *) return;;
esac

$ cat ~/.profile
if [ -n "$BASH_VERSION" ]; then
  if [ -f "$HOME/.bashrc" ]; then
    source "$HOME/.bashrc"
  fi
fi

这是问题所在:

$ git pull origin master
fatal: protocol error: bad line length character: ?]0;
# ... and then git hangs.

我使用的计算机从 GitHub 和 AWS CodeCommit 上托管的所有存储库中获得相同的结果。

下面给出expected response

$ ssh git@github.com
PTY allocation request failed on channel 0
Hi mslinn! Youve successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

今天出现了这个问题。昨天我到处更改了很多配置文件。今天我试着把它们都反了,但显然至少还有一个。

另一台机器,未更改,可以 git pull 来自所有 repos 而没有任何问题。

这是怎么回事?

我发现了一个问题的新原因,该问题在其他人报告时是由其他因素引起的。

$HOME/.ssh/config 我添加了这个:

Host *
    PermitLocalCommand yes
    LocalCommand printf '3]0;%%s[=10=]7' "%r@%n"

printf 是问题所在。注释掉这 3 行解决了问题。

恶作剧得到控制。