GitCloneTask doesn't clone repository (“The remote end hung up unexpectedly”)

i’m trying to write a buildfile with phing and the GitCloneTask (to clone a repo from github), but i keep getting this message everytime i run phing:

The remote end hung up unexpectedly

  • Jenkins - How can i pass parameters from the Upstream to Downstream
  • How do I avoid issues with “Protected Mode” using IEDriverServer in Selenium?
  • TFS Labels in a Build Continuous Environment with Jenkins
  • Maven plugin for versioning and minifying javascript
  • Hudson build fails with Git repository & Grails
  • Dependency projects in a TFS Git project VNEXT build
  • So i checked if i could clone the repo with git-clone => works just fine;

    checked my .gitconfig for an error with the Github API Token & Username => no typos or something

    checked all repo-urls provided on github (ssh, https, read-only) => none of them changes the message when used in the buildfile

    any ideas?

    here’s the code of the buildfile:

    <?xml version="1.0" encoding="UTF-8"?>
    <project name="ort" default="init">
    <!-- ============================================  -->
    <!-- Target: initialize                            -->
    <!-- ============================================  -->
        <target name="init"> 
            <input propertyname="local.documentRoot">Where to put the files?:</input>
            <mkdir dir="${local.documentRoot}" />
                targetPath="${local.documentRoot}" />

  • Git missing commits
  • What does each of the stand for in context of git -p
  • Using WebDav with Git - good or bad idea?
  • Error in Git- fatal: '/Users/username/Downloads/folder_name' is outside repository
  • How to get branch name in log?
  • Version control for tickets?
  • 3 Solutions collect form web for “GitCloneTask doesn't clone repository (“The remote end hung up unexpectedly”)”

    I did some debugging in the phing class and I think the issue is that you need to specify the path/name of your git binary in the “gitPath” attribute.

    I think on Linux is might be something like “/usr/lib/git”, I’m running windows and simply used “git”

    <target name="gitclone">
        <echo msg="Getting latest code from ${git.repo}" />
        <gitclone gitPath="git" repository="${git.repo}" targetPath="${build.dir}" />

    This worked because my git binary (C:\Program Files\Git\cmd) is in my windows PATH…i.e. I can open a command prompt and type “git” and windows will know where it is.

    Annoyingly I am cloning a private repo which requires me to enter a passphrase as well -_-

    i didn’t figure out why the GitCloneTask doesn’t work as expected, but i solved my resulting problem – no automatic repo-cloning – with a workaround: i didn’t use GitCloneTask, instead i used the execTask:

    Here’s my code:

    <property name="remote.repositoryPath" value="git://" />
    <input propertyname="local.documentRoot">Where to put the files?:</input>
    <exec command="git clone ${remote.repositoryPath} ${local.documentRoot}" />

    Neither an elegant nor the ideal solution, but for now it works…

    In my case I didn’t have permission to clone to the directory I was trying to clone to. I didn’t know this because the error didn’t mention it. Someone has created a patch but it is not merged to the mainline as of this posting.

    Take a look at where the exception is being thrown by running phing with -verbose. In my case it was coming from GitCloneTask.php line 77 which said.

    throw new BuildException('The remote end hung up unexpectedly');

    I modified this to include the root cause.

    throw new BuildException('The remote end hung up unexpectedly', $e);

    And I now get:

    fatal: could not create work tree dir 'your-repo'.: Permission denied

    Fixed permissions and it now works fine.

    Git Baby is a git and github fan, let's start git clone.