Skip to main content
Oct 25, 2016 8:07 AM UTC

Git clone not working from remote

I did a few tests with git. Locally, all was fine.

One problem: when creating a bare repository on z/OS, and then trying to clone it from my laptop I get.
Cloning into ‘repos1’…
bash: git-upload-pack: command not found
fatal: Could not read from remote repository.

When showing the path with
ssh manfred@hostsystem ‘echo $PATH’

I get
/bin

which seems to be the compiled path on the sshd server side.

As a workaround I created symlinks of the git utilities in /bin but now I got

fatal: protocol error: bad line length character: ����

Perhaps I did a stupid mistake. If yes please enlighten me if not then my question: How do I configure the PATH variable so that I could clone from remote?

–
Thanks, Manfred

    23 replies

    Oct 27, 2016 10:20 AM UTC

    I did a few tests with git. Locally, all was fine.

    One problem: when creating a bare repository on z/OS, and then trying to clone it from my laptop I get.
    Cloning into ‘repos1’…
    bash: git-upload-pack: command not found
    fatal: Could not read from remote repository.

    When showing the path with
    ssh manfred@hostsystem ‘echo $PATH’

    I get
    /bin

    which seems to be the compiled path on the sshd server side.

    As a workaround I created symlinks of the git utilities in /bin but now I got

    fatal: protocol error: bad line length character: ����

    Perhaps I did a stupid mistake. If yes please enlighten me if not then my question: How do I configure the PATH variable so that I could clone from remote?

    –
    Thanks, Manfred

    Hi, Manfred.

    Git on z/OS does not work as a git server at this moment.

    Regards,
    Andrey

    Oct 31, 2016 1:21 AM UTC

    I did a few tests with git. Locally, all was fine.

    One problem: when creating a bare repository on z/OS, and then trying to clone it from my laptop I get.
    Cloning into ‘repos1’…
    bash: git-upload-pack: command not found
    fatal: Could not read from remote repository.

    When showing the path with
    ssh manfred@hostsystem ‘echo $PATH’

    I get
    /bin

    which seems to be the compiled path on the sshd server side.

    As a workaround I created symlinks of the git utilities in /bin but now I got

    fatal: protocol error: bad line length character: ����

    Perhaps I did a stupid mistake. If yes please enlighten me if not then my question: How do I configure the PATH variable so that I could clone from remote?

    –
    Thanks, Manfred

    Hi Andrey, thanks for the info.

    Dec 30, 2016 1:38 PM UTC

    Hi Andrey, thanks for the info.

    Manfred, I was having the same problem. I finally worked out how to get past that problem.

    I did not want to put all the git programs into the /bin programs. So the problem was how to get the the path changed in a non-login non-interactive shell (which is what gets generated to handle the request). /etc/profile and ~/.profile only get invoked from a login shell, so I couldn’t use those to set the path. .bashrc only gets invoked from a non-login interactive shell, so it did not do the trick by itself either.

    What I ended up needing to do was first modify the /etc/ssh/sshd_config file to uncomment and set

    PermitUserEnvironment yes

    which then allows you to have a ~/.ssh/environment file which contains

    BASH_ENV=~/.bashrc

    so now in a non-login non-interactive shell, you can get the ~/.bashrc (or any other script you put in the BASH_ENV variable above) to execute.

    In my ~/.bashrc I have

    export PATH=/usr/local/git/bin:$PATH

    which now got me access to the executables.

    Problem 1 solved, but I’m still running into a second problem that I have not overcome yet, perhaps because the product is not ready to run as a server yet.

    From my git repository on my windows machine I run

    git remote add myZOS ssh://myUser@myZOS.mydomain.com/u/myUser/mygit/myProduct
    git pull myZOS

    and get a response of

    fatal: protocol error: bad line length character: ▒▒▒
    Unable to write to standard output: The pipe is being closed.

    This often is related to a problem with a response of some error, so I used

    ssh myUser@myZOS.mydomain.com git-receive-pack /u/myUser/mygit/myProduct

    to verify. I was having a problem with the public key, Once I fixed that, I now get

    fatal: protocol error: bad line length character:

    followed by some junk… I haven’t gotten past that yet.

    Jan 4, 2017 10:16 AM UTC

    Manfred, I was having the same problem. I finally worked out how to get past that problem.

    I did not want to put all the git programs into the /bin programs. So the problem was how to get the the path changed in a non-login non-interactive shell (which is what gets generated to handle the request). /etc/profile and ~/.profile only get invoked from a login shell, so I couldn’t use those to set the path. .bashrc only gets invoked from a non-login interactive shell, so it did not do the trick by itself either.

    What I ended up needing to do was first modify the /etc/ssh/sshd_config file to uncomment and set

    PermitUserEnvironment yes

    which then allows you to have a ~/.ssh/environment file which contains

    BASH_ENV=~/.bashrc

    so now in a non-login non-interactive shell, you can get the ~/.bashrc (or any other script you put in the BASH_ENV variable above) to execute.

    In my ~/.bashrc I have

    export PATH=/usr/local/git/bin:$PATH

    which now got me access to the executables.

    Problem 1 solved, but I’m still running into a second problem that I have not overcome yet, perhaps because the product is not ready to run as a server yet.

    From my git repository on my windows machine I run

    git remote add myZOS ssh://myUser@myZOS.mydomain.com/u/myUser/mygit/myProduct
    git pull myZOS

    and get a response of

    fatal: protocol error: bad line length character: ▒▒▒
    Unable to write to standard output: The pipe is being closed.

    This often is related to a problem with a response of some error, so I used

    ssh myUser@myZOS.mydomain.com git-receive-pack /u/myUser/mygit/myProduct

    to verify. I was having a problem with the public key, Once I fixed that, I now get

    fatal: protocol error: bad line length character:

    followed by some junk… I haven’t gotten past that yet.

    Hi Tim,
    In the end you are stuck where I was stuck, namely:
    fatal: protocol error: bad line length character:

    Jan 9, 2017 9:46 AM UTC

    I did a few tests with git. Locally, all was fine.

    One problem: when creating a bare repository on z/OS, and then trying to clone it from my laptop I get.
    Cloning into ‘repos1’…
    bash: git-upload-pack: command not found
    fatal: Could not read from remote repository.

    When showing the path with
    ssh manfred@hostsystem ‘echo $PATH’

    I get
    /bin

    which seems to be the compiled path on the sshd server side.

    As a workaround I created symlinks of the git utilities in /bin but now I got

    fatal: protocol error: bad line length character: ����

    Perhaps I did a stupid mistake. If yes please enlighten me if not then my question: How do I configure the PATH variable so that I could clone from remote?

    –
    Thanks, Manfred

    z/OS git does not currently work as a git server. It can pull from or push to other git servers, but not the other way around.

    Jan 11, 2017 9:36 AM UTC

    I did a few tests with git. Locally, all was fine.

    One problem: when creating a bare repository on z/OS, and then trying to clone it from my laptop I get.
    Cloning into ‘repos1’…
    bash: git-upload-pack: command not found
    fatal: Could not read from remote repository.

    When showing the path with
    ssh manfred@hostsystem ‘echo $PATH’

    I get
    /bin

    which seems to be the compiled path on the sshd server side.

    As a workaround I created symlinks of the git utilities in /bin but now I got

    fatal: protocol error: bad line length character: ����

    Perhaps I did a stupid mistake. If yes please enlighten me if not then my question: How do I configure the PATH variable so that I could clone from remote?

    –
    Thanks, Manfred

    I am getting the error when also trying to clone my local repo. Should I think this because the same reason that z/OS git does not currently work as a server. If so, should I think “git clone” is a dummy command in z/OS git (at least for now.)

    command: git clone /u/ttg/coderepo/project1/.git /u/ttg/coderepo/project2
    error: cannot run git-upload-pack ‘/u/ttg/coderepo/project1/.git’: EDC5129I No such file or directory.
    fatal: unable to fork

    command: git clone /u/ttg/coderepo/project1 /u/ttg/coderepo/project2
    error: cannot run git-upload-pack ‘/u/ttg/coderepo/project1’: EDC5129I No such file or directory.
    fatal: unable to fork

    Jan 11, 2017 10:25 AM UTC

    I am getting the error when also trying to clone my local repo. Should I think this because the same reason that z/OS git does not currently work as a server. If so, should I think “git clone” is a dummy command in z/OS git (at least for now.)

    command: git clone /u/ttg/coderepo/project1/.git /u/ttg/coderepo/project2
    error: cannot run git-upload-pack ‘/u/ttg/coderepo/project1/.git’: EDC5129I No such file or directory.
    fatal: unable to fork

    command: git clone /u/ttg/coderepo/project1 /u/ttg/coderepo/project2
    error: cannot run git-upload-pack ‘/u/ttg/coderepo/project1’: EDC5129I No such file or directory.
    fatal: unable to fork

    cloning locally works fine for me

    Jan 11, 2017 11:11 AM UTC

    I am getting the error when also trying to clone my local repo. Should I think this because the same reason that z/OS git does not currently work as a server. If so, should I think “git clone” is a dummy command in z/OS git (at least for now.)

    command: git clone /u/ttg/coderepo/project1/.git /u/ttg/coderepo/project2
    error: cannot run git-upload-pack ‘/u/ttg/coderepo/project1/.git’: EDC5129I No such file or directory.
    fatal: unable to fork

    command: git clone /u/ttg/coderepo/project1 /u/ttg/coderepo/project2
    error: cannot run git-upload-pack ‘/u/ttg/coderepo/project1’: EDC5129I No such file or directory.
    fatal: unable to fork

    I have also tested cloning a local repo, and it works for me.

    If you just type “git-upload-pack” at the command prompt, what happens? The message you are getting seems to suggest that git-upload-pack isn’t being found.

    Jan 12, 2017 3:27 AM UTC

    I have also tested cloning a local repo, and it works for me.

    If you just type “git-upload-pack” at the command prompt, what happens? The message you are getting seems to suggest that git-upload-pack isn’t being found.

    Hello.
    When I type only git-upload-pack, the following message I get. I think it can’t find the repository, not the command itsef. I think i have made a mistake in installation. I am going to reinstall this time into my own users folder (/u/myuser) instead of /u/ptools/zosgit and try again.

    myuser:/u/ttg/coderepo/project1: >git-upload-pack
    usage: git upload-pack [–strict] [–timeout=]

    Jan 12, 2017 5:33 AM UTC

    cloning locally works fine for me

    Hello Manfred.
    Can you give a sample git clone command you use for local clone. You mean from one directory in your local directory into another folder again in your directory? Or cloning a remore repository into a zos git folder…

    Thanks in advance.