GIT errors during Clone. "error: cannot spawn git:"


  • | 2181 points

    Hi, I'm using Laragon 4.0 Full, Win 10, which FYI is working perfectly for WP installs.

    I'm also attempting to clone a non-WP repo from GitHub but I'm getting the following error: "error: cannot spawn git: Invalid argument" after using the git clone command.

    I created a 'blank' Quick App using Laragon.
    Then in Cmder:
    bash
    cd testsite
    git init
    .. Initialized empty Git repository in C:/laragon/www/GITTEST/.git/
    git clone https://github.com/atom/github.git
    .. Cloning into 'github'...
    .. error: cannot spawn git: Invalid argument

    Can somebody explain the easiest way to clone a GitHub repo using the GIT that comes with Laragon?

    Thanks.

    P.S. Could it be anything to do with the Paths settings in Tools / Paths / Manage Paths? Mine seem strange with a semi-colon on its own at the top and one missing near the bottom (after VSC), along with some of my paths repeated:

    --------------- Laragon ---------------
    ;
    C:\laragon\bin;
    C:\laragon\bin\apache\httpd-2.4.35-win64-VC15\bin;
    C:\laragon\bin\composer;
    C:\laragon\bin\git\bin;
    C:\laragon\bin\git\cmd;
    C:\laragon\bin\git\mingw64\bin;
    C:\laragon\bin\git\usr\bin;
    C:\laragon\bin\laragon\utils;
    C:\laragon\bin\mysql\mariadb-10.3.10-winx64\bin;
    C:\laragon\bin\nginx\nginx-1.14.0;
    C:\laragon\bin\ngrok;
    C:\laragon\bin\notepad++;
    C:\laragon\bin\php\php-7.2.11-Win32-VC15-x64;
    C:\laragon\bin\putty;
    C:\laragon\bin\redis\redis-x64-3.2.100;
    C:\laragon\bin\telnet;
    C:\laragon\usr\bin;
    C:\Users\John King\AppData\Local\Yarn\config\global\node_modules.bin;
    C:\Users\John King\AppData\Roaming\Composer\vendor\bin;
    C:\Users\John King\AppData\Roaming\npm;

    --------------- User ---------------
    C:\laragon\bin;
    C:\laragon\bin\apache\httpd-2.4.35-win64-VC15\bin;
    C:\laragon\bin\composer;
    C:\laragon\bin\git\bin;
    C:\laragon\bin\git\cmd;
    C:\laragon\bin\git\mingw64\bin;
    C:\laragon\bin\git\usr\bin;
    C:\laragon\bin\laragon\utils;
    C:\laragon\bin\mysql\mariadb-10.3.10-winx64\bin;
    C:\laragon\bin\nginx\nginx-1.14.0;
    C:\laragon\bin\ngrok;
    C:\laragon\bin\notepad++;
    C:\laragon\bin\php\php-7.2.11-Win32-VC15-x64;
    C:\laragon\bin\putty;
    C:\laragon\bin\redis\redis-x64-3.2.100;
    C:\laragon\bin\telnet;
    C:\laragon\usr\bin;
    C:\Users\John King\AppData\Local\Yarn\config\global\node_modules.bin;
    C:\Users\John King\AppData\Roaming\Composer\vendor\bin;
    C:\Users\John King\AppData\Roaming\npm;
    C:\Users\John King\AppData\Local\Microsoft\WindowsApps;
    C:\VSC\bin

    --------------- System ---------------
    C:\Windows\system32;
    C:\Windows;
    C:\Windows\System32\Wbem;
    C:\Windows\System32\WindowsPowerShell\v1.0;
    C:\Windows\System32\OpenSSH;
    C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common


  • administrators
    | 97438 points

    @John-King : I don't think PATH is the issue. Why you used bash before cloning?
    and you don't need to use Quick app > Blank for working with projects on github.

    You may try:

    1. Create a database (Menu > MySQL > Create database)
    2. cd to DocRoot
    cd %DOCUMENT_ROOT%
    
    1. Clone your repo

  • | 2181 points

    @leokhoa Thanks for your response. As you can tell I'm new at this.

    So, I tried some things and I'm still getting errors. This is from a basic first-time install of Laragon Full 4.0 with no previous version of GIT installed on a new Windows 10 Home machine.

    1. Cmder:

    C:\laragon\www
    λ cd %DOCUMENT_ROOT%

    C:\laragon\www
    λ git clone https://github.com/apache/cordova-plugin-statusbar.git
    Cloning into 'cordova-plugin-statusbar'...
    error: cannot spawn git: Invalid argument

    1. If I run c:/laragon/bin/git/git-cmd.exe

    C:\laragon\bin\git>cd %DOCUMENT_ROOT%
    The system cannot find the path specified.

    C:\laragon\bin\git>cd..

    C:\laragon\bin>cd..

    C:\laragon>cd www

    C:\laragon\www>git clone https://github.com/apache/cordova-plugin-statusbar.git
    Cloning into 'cordova-plugin-statusbar'...
    error: cannot spawn git: Invalid argument

    Notes:

    a. Running git-cmd it didn't know where %DOCUMENT_ROOT% was (maybe expected behavior?).
    b. c:/laragon/bin/git still has a 278MB install tar file in the directory. Maybe it didn't install properly?
    c. Menu / Laragon / laragon.log is empty (maybe expected?)
    d. laragon.ini - no GIT settings in here (maybe expected?)

    ** Extra note. After this I uninstalled Laragon, deleted remaining environment paths, disabled laragon from starting (it left a legacy start up task which repopulated the environment paths), then reinstalled Laragon. I was getting the exactly the same error message and behavior.

    ** More Notes. Here is a dump of my Cmder log when trying to set up some SSH keys along with the SSH agent:

    C:\laragon\www
    λ git config -l
    core.symlinks=false
    core.autocrlf=true
    color.diff=auto
    color.status=auto
    color.branch=auto
    color.interactive=true
    pack.packsizelimit=2g
    help.format=html
    http.sslcainfo=/ssl/certs/ca-bundle.crt
    diff.astextplain.textconv=astextplain
    rebase.autosquash=true
    filter.lfs.clean=git-lfs clean -- %f
    filter.lfs.smudge=git-lfs smudge -- %f
    filter.lfs.process=git-lfs filter-process
    filter.lfs.required=true
    user.name=John King
    user.email=<< My email address >>

    C:\laragon\www
    λ ssh-keygen -t rsa -b 4096 -C "<< My email address >>"
    Generating public/private rsa key pair.
    Enter file in which to save the key (/c/Users/John King/.ssh/id_rsa):
    /c/Users/John King/.ssh/id_rsa already exists.
    Overwrite (y/n)? y
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /c/Users/John King/.ssh/id_rsa.
    Your public key has been saved in /c/Users/John King/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:**********************************
    The key's randomart image is:


    C:\laragon\www
    λ ls -al ~/.ssh
    total 24
    drwxr-xr-x 1 John King 197121 0 Nov 19 18:46 .
    drwxr-xr-x 1 John King 197121 0 Nov 20 12:51 ..
    -rw-r--r-- 1 John King 197121 3326 Nov 20 13:03 id_rsa
    -rw-r--r-- 1 John King 197121 749 Nov 20 13:03 id_rsa.pub
    -rw-r--r-- 1 John King 197121 800 Nov 19 19:01 known_hosts

    C:\laragon\www
    λ eval $(ssh-agent -s)
    'eval' is not recognized as an internal or external command,
    operable program or batch file.

    C:\laragon\www
    λ ssh-agent -s
    SSH_AUTH_SOCK=/tmp/ssh-Lzipy7uInXjx/agent.10264; export SSH_AUTH_SOCK;
    SSH_AGENT_PID=7896; export SSH_AGENT_PID;
    echo Agent pid 7896;

    C:\laragon\www
    λ ssh-add ~/.ssh/id_rsa
    Could not open a connection to your authentication agent.

    C:\laragon\www
    λ echo $HOME
    $HOME

    C:\laragon\www
    λ start-ssh-agent.cmd
    Removing old ssh-agent sockets
    Starting ssh-agent: done
    Enter passphrase for /c/Users/John King/.ssh/id_rsa:
    Identity added: /c/Users/John King/.ssh/id_rsa (/c/Users/John King/.ssh/id_rsa)

    C:\laragon\www
    λ ssh-add ~/.ssh/id_rsa
    Enter passphrase for /c/Users/John King/.ssh/id_rsa:
    Identity added: /c/Users/John King/.ssh/id_rsa (/c/Users/John King/.ssh/id_rsa)

    C:\laragon\www
    λ git clone https://github.com/apache/cordova-plugin-statusbar.git
    Cloning into 'cordova-plugin-statusbar'...
    error: cannot spawn git: Invalid argument


  • | 2181 points

    @leokhoa One more possibly replated thing. I'm wondering if the gap in my user name 'John King' is causing some issues somewhere. In Cmder if I go to new / bash / bash as admin I get the following error:

    The system cannot find the path specified.

    Current directory:
    C:\Users\John King

    Command to be executed:
    "C:\Windows\SYSTEM32\cmd.exe" /c "C:\laragon\bin\cmder\vendor\conemu-maximus5..\git-for-windows\bin\bash --login -i"

    ConEmuC: Root process was alive less than 10 sec, ExitCode=1.
    Press Enter or Esc to close console...


  • | 2181 points

    @leokhoa Update. I have run some test that show that I have successfully created an ssh connection to github. These Cmder logs are probably the most clearest to see what's happening:

    C:\Users\John King
    λ ssh -vT git@github.com
    OpenSSH_7.7p1, OpenSSL 1.0.2p 14 Aug 2018
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: Connecting to github.com [140.82.118.4] port 22.
    debug1: Connection established.
    debug1: identity file /c/Users/John King/.ssh/id_rsa type 0
    .......
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: SSH2_MSG_NEWKEYS received
    debug1: rekey after 134217728 blocks
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey
    debug1: Next authentication method: publickey
    debug1: Offering public key: RSA SHA256:KEY_HERE /c/Users/John King/.ssh/id_rsa
    debug1: Server accepts key: pkalg ssh-rsa blen 535
    Enter passphrase for key '/c/Users/John King/.ssh/id_rsa':
    debug1: Authentication succeeded (publickey).
    Authenticated to github.com ([140.82.118.4]:22).
    debug1: channel 0: new [client-session]
    debug1: Entering interactive session.
    debug1: pledge: network
    debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
    Hi MYGITHUBUSERNAME! You've successfully authenticated, but GitHub does not provide shell access.
    debug1: channel 0: free: client-session, nchannels 1
    Transferred: sent 3448, received 2024 bytes, in 0.2 seconds
    Bytes per second: sent 14982.3, received 8794.7
    debug1: Exit status 1

    C:\laragon\www
    λ git clone https://github.com/jackmoore/colorbox.git
    Cloning into 'colorbox'...
    error: cannot spawn git: Invalid argument

    C:\laragon\www
    λ git clone git@github.com:jackmoore/colorbox.git
    Cloning into 'colorbox'...
    Enter passphrase for key '/c/Users/John King/.ssh/id_rsa':
    remote: Enumerating objects: 2618, done.
    error: cannot spawn git: No such file or directory
    fatal: fetch-pack: unable to fork off index-pack

    C:\Users\John King
    λ bash

    John King@DESKTOP-TNLFT28 MINGW64 ~
    $ GIT_TRACE=2 git clone git@github.com:jackmoore/colorbox.git
    18:09:53.767075 exec-cmd.c:236 trace: resolved executable dir: C:/laragon/bin/git/mingw64/bin
    18:09:53.767075 git.c:415 trace: built-in: git clone git@github.com:jackmoore/colorbox.git
    Cloning into 'colorbox'...
    18:09:53.798327 run-command.c:637 trace: run_command: unset GIT_DIR; ssh git@github.com 'git-upload-pack '''jackmoore/colorbox.git'''' Enter passphrase for key '/c/Users/John King/.ssh/id_rsa':
    18:09:59.702995 run-command.c:637 trace: run_command: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 10288 on DESKTOP-TNLFT28' --check-self-contained-and-connected
    remote: Enumerating objects: 2618, done.
    error: cannot spawn git: No such file or directory
    fatal: fetch-pack: unable to fork off index-pack


  • | 2181 points

    @leokhoa Hi, I may be getting closer. I read some Stack Overflows where they were having a similar error and they said to set the Environmental Variable GIT_SSH which I have to "C:\laragon\bin\git\usr\bin\ssh.exe".

    This still produced the error.

    Do you think that the unset GIT_DIR variable in this line of the trace could be causing the problem, or does this appear as unset when you successfully clone a GIT repository?

    Cloning into 'colorbox'...
    19:22:22.719515 run-command.c:637 trace: run_command: unset GIT_DIR; 'C:\laragon\bin\git\usr\bin\ssh.exe' git@github.com 'git-upload-pack '''jackmoore/colorbox.git''''


  • administrators
    | 97438 points

    @John-King : You are getting closer - please keep investigating. I'm on holiday so I can not fullly support.


  • | 2181 points

    Hi, just to let you know I gave up (I don't have the technical chops) and I've installed git for windows as a standard system Windows install. This seems to work fine with Laragon's Cmder.

    If somebody else has the same issue they can take over from here. Thanks so much for Laragon, it's brilliant!

    John..


  • administrators
    | 97438 points

    @John-King : I found the issue. The root cause is the package on git-for-windows

    I created a stable package and put to github.com: https://github.com/leokhoa/laragon-packages/releases/download/4.0/git-2.19.2.zip
    You can use it in the future (for portability).


  • | 132 points

    Downloading the zip file and exporting the contents in your C:\{Laragon_Path}\bin\git folder (replace all if conflicts) solves this issue. Thanks @leokhoa @John-King


Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.