1

This question is almost identical to another, however the solution is not working.

First, let me show you everything I can think of that might be relevant:

$ 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

Here is the problem:

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

The computer I am using gets the same result from all repos hosted on GitHub and AWS CodeCommit.

The following gives the 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.

The problem showed up today. Yesterday I changed many configuration files all over the place. Today I tried to reverse them all, but obviously at least one still remains.

Another machine, unchanged, can git pull from all repos without any issue.

What could the matter be?

halfer
  • 19,824
  • 17
  • 99
  • 186
Mike Slinn
  • 7,705
  • 5
  • 51
  • 85

1 Answers1

0

I discovered a new cause for an issue which has been due to other factors when reported by other people.

In $HOME/.ssh/config I had added this:

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

The printf was the problem. Commenting out these 3 lines solved the issue.

Mischief managed.

Mike Slinn
  • 7,705
  • 5
  • 51
  • 85
  • That's the command sequence to set the title bar in many terminal emulators. Best to do this in your bash profile *after* you've determined that this is a new, interactive login session. Then operations that aren't interactive login sessions—such as `git fetch`—won't trigger it. – torek Feb 03 '22 at 11:03