hudson.plugins.git.GitException: Clone returned an error code

Jenkins JIRA | acmarques | 8 years ago
  1. 0

    We've found an issue using Hudson + Git plugin on Windows: when the plugin tries to execute a clone in a repository (local or remote), the following error occurs: started Checkout (clone) Cloning repository C:/sistemas_ruby/teste $ git clone C:/sistemas_ruby/teste "/C:/Documents and Settings/Antonio.HOME- 2983D23F4B/.hudson/jobs/Teste/workspace" fatal: could not create leading directories of '/C:/Documents and Settings/Antonio.HOME-2983D23F4B/.hudson/jobs/Teste/workspace': Invalid argument FATAL: Clone returned an error code hudson.plugins.git.GitException: Clone returned an error code at hudson.plugins.git.GitAPI.clone(GitAPI.java:142) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:264) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:235) at hudson.FilePath.act(FilePath.java:389) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:235) at hudson.model.AbstractProject.checkout(AbstractProject.java:666) at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:264) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:238) at hudson.model.Run.run(Run.java:823) at hudson.matrix.MatrixBuild.run(MatrixBuild.java:100) at hudson.model.ResourceController.execute(ResourceController.java:70) at hudson.model.Executor.run(Executor.java:90) The problem is the first slash on the path of the workspace ("/C:/Documents…"). I guess that on Linux this shouldn't be a problem, but on windows this slash causes an error. I downloaded the sources from Maven browser (http://www.mvnbrowser.com/artifact- details.html?groupId=org.jvnet.hudson.plugins&artifactId=git&version=0.5 ) and found that the problem occurs in the class GitAPI.java, in the following line of the clone method: args.add(source, workspace.toURI().getPath()); It seems that the method toURI() of the FilePath class always returns a string beginning with a slash. So, I've changed this line to the following: if(workspace.isRemote()) args.add(source, workspace.toURI().getPath()); else{ final ArgumentListBuilder argsTmp = args; final String sourceTmp = source; args = workspace.act(new FileCallable<ArgumentListBuilder>() { public ArgumentListBuilder invoke(File workspace, VirtualChannel channel) throws IOException { return argsTmp.add(sourceTmp, workspace.toString()); } }); } And it works pretty well for me, at least in a windows environment. I would like to ask you to please verify if this modification is correct and, if possible, to include it in a next version of the plugin.

    Jenkins JIRA | 8 years ago | acmarques
    hudson.plugins.git.GitException: Clone returned an error code
  2. 0

    We've found an issue using Hudson + Git plugin on Windows: when the plugin tries to execute a clone in a repository (local or remote), the following error occurs: started Checkout (clone) Cloning repository C:/sistemas_ruby/teste $ git clone C:/sistemas_ruby/teste "/C:/Documents and Settings/Antonio.HOME- 2983D23F4B/.hudson/jobs/Teste/workspace" fatal: could not create leading directories of '/C:/Documents and Settings/Antonio.HOME-2983D23F4B/.hudson/jobs/Teste/workspace': Invalid argument FATAL: Clone returned an error code hudson.plugins.git.GitException: Clone returned an error code at hudson.plugins.git.GitAPI.clone(GitAPI.java:142) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:264) at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:235) at hudson.FilePath.act(FilePath.java:389) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:235) at hudson.model.AbstractProject.checkout(AbstractProject.java:666) at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:264) at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:238) at hudson.model.Run.run(Run.java:823) at hudson.matrix.MatrixBuild.run(MatrixBuild.java:100) at hudson.model.ResourceController.execute(ResourceController.java:70) at hudson.model.Executor.run(Executor.java:90) The problem is the first slash on the path of the workspace ("/C:/Documents…"). I guess that on Linux this shouldn't be a problem, but on windows this slash causes an error. I downloaded the sources from Maven browser (http://www.mvnbrowser.com/artifact- details.html?groupId=org.jvnet.hudson.plugins&artifactId=git&version=0.5 ) and found that the problem occurs in the class GitAPI.java, in the following line of the clone method: args.add(source, workspace.toURI().getPath()); It seems that the method toURI() of the FilePath class always returns a string beginning with a slash. So, I've changed this line to the following: if(workspace.isRemote()) args.add(source, workspace.toURI().getPath()); else{ final ArgumentListBuilder argsTmp = args; final String sourceTmp = source; args = workspace.act(new FileCallable<ArgumentListBuilder>() { public ArgumentListBuilder invoke(File workspace, VirtualChannel channel) throws IOException { return argsTmp.add(sourceTmp, workspace.toString()); } }); } And it works pretty well for me, at least in a windows environment. I would like to ask you to please verify if this modification is correct and, if possible, to include it in a next version of the plugin.

    Jenkins JIRA | 8 years ago | acmarques
    hudson.plugins.git.GitException: Clone returned an error code
  3. 0

    hudson에서 git clone시 에러가 발생합니다.

    GitHub | 3 years ago | bobosfirsttower
    hudson.plugins.git.GitException: Could not clone
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Jenkins can not clone Git repository over Git/SSH on Windows

    Stack Overflow | 5 years ago | Željko Filipin
    hudson.plugins.git.GitException: Could not clone

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. hudson.plugins.git.GitException

      Clone returned an error code

      at hudson.plugins.git.GitAPI.clone()
    2. Hudson GIT plugin
      GitSCM$2.invoke
      1. hudson.plugins.git.GitAPI.clone(GitAPI.java:142)
      2. hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:264)
      3. hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:235)
      3 frames
    3. Hudson
      FilePath.act
      1. hudson.FilePath.act(FilePath.java:389)
      1 frame
    4. Hudson GIT plugin
      GitSCM.checkout
      1. hudson.plugins.git.GitSCM.checkout(GitSCM.java:235)
      1 frame
    5. Hudson
      Executor.run
      1. hudson.model.AbstractProject.checkout(AbstractProject.java:666)
      2. hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:264)
      3. hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:238)
      4. hudson.model.Run.run(Run.java:823)
      5. hudson.matrix.MatrixBuild.run(MatrixBuild.java:100)
      6. hudson.model.ResourceController.execute(ResourceController.java:70)
      7. hudson.model.Executor.run(Executor.java:90)
      7 frames