Skip to main content
Nov 20, 2018 4:18 PM UTC

Git Bad line length character

HI I am trying to use git on our OMVS installation and I am having some trouble. I want to be able to push to and pull from our remote git server
I was able to set up a ssh key and authenticate with
ssh -T git@git.our-git-server.com

I get the response

FOTS2190 Failed to add the host to the list of known hosts (/u/tmp/.ssh/known_hosts).
Hi myusername! You've successfully authenticated, but GitHub does not provide shell access.

I pulled some code from my PDS to a unix file with cp then tagged it all as iso8859-1 with
chtag -t -c iso8859-1 filename

I created a git repo with the .gitattributes that the forum post hear recommends.
I was able to do git init and git add and set the origin.
However, when I try to do a git push or a git fetch I get the following error

FOTS2190 Failed to add the host to the list of known hosts (/u/tmp/.ssh/known_hosts).
fatal: protocol error: bad line length character: ▒▒▒▒

(/u/tmp is ~ )

btw i am using bash-4.3 as my shell
and my git version is

bash-4.3$ /git/bin/git --version
git version 2.3.5_os390_b013

    3 replies

    Alex Tishkov
    Rocketeer
    Nov 22, 2018 3:07 AM UTC

    HI I am trying to use git on our OMVS installation and I am having some trouble. I want to be able to push to and pull from our remote git server
    I was able to set up a ssh key and authenticate with
    ssh -T git@git.our-git-server.com

    I get the response

    FOTS2190 Failed to add the host to the list of known hosts (/u/tmp/.ssh/known_hosts).
    Hi myusername! You've successfully authenticated, but GitHub does not provide shell access.
    
    

    I pulled some code from my PDS to a unix file with cp then tagged it all as iso8859-1 with
    chtag -t -c iso8859-1 filename

    I created a git repo with the .gitattributes that the forum post hear recommends.
    I was able to do git init and git add and set the origin.
    However, when I try to do a git push or a git fetch I get the following error

    FOTS2190 Failed to add the host to the list of known hosts (/u/tmp/.ssh/known_hosts).
    fatal: protocol error: bad line length character: ▒▒▒▒
    

    (/u/tmp is ~ )

    btw i am using bash-4.3 as my shell
    and my git version is

    bash-4.3$ /git/bin/git --version
    git version 2.3.5_os390_b013
    

    https://www.ibm.com/support/knowledgecenter/SSLTBW_2.2.0/com.ibm.zos.v2r2.foto100/msg-FOTS2190.htm

    Could you check if hostfile is writable by your user:

    ls -ltr ~/.ssh/known_hosts

    Or delete the known_hosts file, and re-run your ssh. This will regenerate the known_host file with appropriate permissions, and add the remote host you are trying to ssh into to this file.

    Nov 23, 2018 4:59 PM UTC

    https://www.ibm.com/support/knowledgecenter/SSLTBW_2.2.0/com.ibm.zos.v2r2.foto100/msg-FOTS2190.htm

    Could you check if hostfile is writable by your user:

    ls -ltr ~/.ssh/known_hosts

    Or delete the known_hosts file, and re-run your ssh. This will regenerate the known_host file with appropriate permissions, and add the remote host you are trying to ssh into to this file.

    I was able to get the git push to work i had forgotten to source the bash script that sets up all the environment variables.
    However, i still have a problem, the files are added to the git repo but the contents come out as garbage i think i have some kind of encoding issue.

    Alex Tishkov
    Rocketeer
    Nov 26, 2018 5:37 AM UTC

    I was able to get the git push to work i had forgotten to source the bash script that sets up all the environment variables.
    However, i still have a problem, the files are added to the git repo but the contents come out as garbage i think i have some kind of encoding issue.

    It could happen if encoding tag of the file differs from actual file encoding.

    There are two encodings used in z/OS Unix System: IBM-1047 and ISO8859-1 (EBCDIC and ASCII)

    To check file encoding:

    chtag -p filename

    To set/change encoding tag:

    chtag -c ISO8859-1 filename

    To convert file content:

    iconv -f IBM-1047 -t ISO8859-1 source_file_name > converted_file