【问题标题】:Git: fatal: protocol error: bad line length character: ?]0; [closed]Git:致命:协议错误:错误的行长度字符:?] 0; [关闭]
【发布时间】:2022-02-14 01:28:58
【问题描述】:

此问题与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来自所有回购,没有任何问题。

怎么回事?

【问题讨论】:

    标签: git ssh


    【解决方案1】:

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

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

    Host *
        PermitLocalCommand yes
        LocalCommand printf '\033]0;%%s\007' "%r@%n"
    

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

    恶作剧管理。

    【讨论】:

    • 这是在许多终端模拟器中设置标题栏的命令序列。最好在您确定这是一个新的交互式登录会话之后 在您的 bash 配置文件中执行此操作。那么不是交互式登录会话的操作(例如git fetch)不会触发它。
    猜你喜欢
    • 1970-01-01
    • 2014-04-14
    • 2023-03-17
    • 1970-01-01
    • 1970-01-01
    • 2019-07-07
    • 2015-08-31
    • 1970-01-01
    • 2015-08-03
    相关资源
    最近更新 更多