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

    Jan 12, 2017 9:29 AM UTC

    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.

    Here is a shell session showing both a remote and local clone on z/OS. These same commands should work for you (assuming you have an account on github and ssh key configured):

    bash-2.03$ uname
    OS/390
    bash-2.03$ git clone git@github.com:zorts/hello_world.git
    Cloning into 'hello_world'...
    bash-2.03$ cd hello_world/
    bash-2.03$ make
    cc -c -o hello.o hello.c
    cc -o hello hello.o
    ./hello
    Hello, world!
    This command is ./hello, and it has 0 arguments
    ./hello with some arguments
    Hello, world!
    This command is ./hello, and it has 3 arguments
    [1]: with
    [2]: some
    [3]: arguments
    bash-2.03$ cd ..
    bash-2.03$ git clone hello_world new_hello_world
    git clone hello_world new_hello_world
    Cloning into 'new_hello_world'...
    done.
    bash-2.03$ cd new_hello_world/
    bash-2.03$ make
    cc -c -o hello.o hello.c
    cc -o hello hello.o
    ./hello
    Hello, world!
    This command is ./hello, and it has 0 arguments
    ./hello with some arguments
    Hello, world!
    This command is ./hello, and it has 3 arguments
    [1]: with
    [2]: some
    [3]: arguments
    bash-2.03$
    Jan 13, 2017 3:08 AM UTC

    Here is a shell session showing both a remote and local clone on z/OS. These same commands should work for you (assuming you have an account on github and ssh key configured):

    bash-2.03$ uname
    OS/390
    bash-2.03$ git clone git@github.com:zorts/hello_world.git
    Cloning into 'hello_world'...
    bash-2.03$ cd hello_world/
    bash-2.03$ make
    cc -c -o hello.o hello.c
    cc -o hello hello.o
    ./hello
    Hello, world!
    This command is ./hello, and it has 0 arguments
    ./hello with some arguments
    Hello, world!
    This command is ./hello, and it has 3 arguments
    [1]: with
    [2]: some
    [3]: arguments
    bash-2.03$ cd ..
    bash-2.03$ git clone hello_world new_hello_world
    git clone hello_world new_hello_world
    Cloning into 'new_hello_world'...
    done.
    bash-2.03$ cd new_hello_world/
    bash-2.03$ make
    cc -c -o hello.o hello.c
    cc -o hello hello.o
    ./hello
    Hello, world!
    This command is ./hello, and it has 0 arguments
    ./hello with some arguments
    Hello, world!
    This command is ./hello, and it has 3 arguments
    [1]: with
    [2]: some
    [3]: arguments
    bash-2.03$

    bash-2.03$ git clone hello_world new_hello_world

    Should I open a seperate bash shell? I am connecting directly via putty, and using git commands. What I didn’t understand is other gir commands like init, add, status … works fine but git clone has driven me crazy. Whatever, thank you very much for your help but i think I got too much time of yours. Sorry for this.

    Jan 13, 2017 4:18 AM UTC

    bash-2.03$ git clone hello_world new_hello_world

    Should I open a seperate bash shell? I am connecting directly via putty, and using git commands. What I didn’t understand is other gir commands like init, add, status … works fine but git clone has driven me crazy. Whatever, thank you very much for your help but i think I got too much time of yours. Sorry for this.

    Hello my problem is resolved when i tried with a clean directory which i created manually. I think the problem was related with my files in the repo. Thank you very much for this exciting tool in zos.

    Jan 26, 2017 3:06 AM UTC

    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.

    A bit late but here it is.

    Cloning locally: git clone /mygit/x.git. Directory x will be created containing the clone of x.git

    Or from gitlab: git clone git@gitlab.com:Lotz/manfred.git which works fine as well.

    May 30, 2017 3: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

    Is it planned to support git as a server on z/OS UNIX?

    – Manfred

    May 30, 2017 8:47 AM UTC

    Is it planned to support git as a server on z/OS UNIX?

    – Manfred

    HI, Manfred. We do not currently plan to support git as a server on z/OS.

    May 31, 2017 2:18 AM UTC

    HI, Manfred. We do not currently plan to support git as a server on z/OS.

    Hi Jerry,
    Thanks for the reply.

    I’m not currently sure if I would regard such a support terribly urgent as of course one could have a repository at github, gitlab or company internal github server. Then one could just clone from there.
    – Manfred

    Jun 2, 2017 2:21 PM 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 stumbled onto this thread as I too was unsuccessfully trying to clone a repo from zOS git and I’m glad the lack of support was mentioned here as I can now move on to other tasks.

    I would like to mention though that the concept of using zOS git as a server is a powerful one. Using zOS git as a client limits the user to using only zOS supported editing tools which imposes hurdles when it comes to working a language like Java which is supported by the powerful Eclipse IDE.

    A hypothetical scenario that server support would allow is where a Java developer could clone a zOS git repo into Eclipse as a project and develop/debug Java code locally, then push to the remote on zOS, compile and run. I think this functionality would only further promote/demonstrate mainframe modernization.

    This scenario is of course still possible with an intermediate remote on a supported platform but adds an unnecessary extra step to the development process and requires extra overhead/infrastructure.

    Just my two cents.

    -Matt

    Jun 2, 2017 4:00 PM UTC

    I stumbled onto this thread as I too was unsuccessfully trying to clone a repo from zOS git and I’m glad the lack of support was mentioned here as I can now move on to other tasks.

    I would like to mention though that the concept of using zOS git as a server is a powerful one. Using zOS git as a client limits the user to using only zOS supported editing tools which imposes hurdles when it comes to working a language like Java which is supported by the powerful Eclipse IDE.

    A hypothetical scenario that server support would allow is where a Java developer could clone a zOS git repo into Eclipse as a project and develop/debug Java code locally, then push to the remote on zOS, compile and run. I think this functionality would only further promote/demonstrate mainframe modernization.

    This scenario is of course still possible with an intermediate remote on a supported platform but adds an unnecessary extra step to the development process and requires extra overhead/infrastructure.

    Just my two cents.

    -Matt

    Hi, Matt. I hear what you’re saying, but support for git as a server on z/OS is just not a high priority for us at this time.This has to do with the specifics of how ssh works on z/OS, and the need to port other libraries to z/OS to be able to support the other git protocols. It turns out to be a difficult problem.

    In addition, systems layered on top of git (such as github and BitBucket) provide very high-value functionality (notably pull requests and code review tools) that most git users will want anyway. We certainly use that functionality internally at Rocket.

    Jun 2, 2017 4:16 PM UTC

    Hi, Matt. I hear what you’re saying, but support for git as a server on z/OS is just not a high priority for us at this time.This has to do with the specifics of how ssh works on z/OS, and the need to port other libraries to z/OS to be able to support the other git protocols. It turns out to be a difficult problem.

    In addition, systems layered on top of git (such as github and BitBucket) provide very high-value functionality (notably pull requests and code review tools) that most git users will want anyway. We certainly use that functionality internally at Rocket.

    Thanks for the additional information on why the server functionality is a tough implementation. It makes sense. Any dismay resulting in the lack of server support is far outweighed by the fact that git is available on zOS. I will certainly explore the use cases that you mentioned. We’re very excited to see what we can do with it.