views:

72

answers:

1

Alright, so I'm having some issues with my repo on github being cloned on my Hudson server which is running Fedora 8. The output is the usual error output when an error is encountered with git:

Started by user anonymous
Checkout:workspace / /home/tomcat/.hudson/jobs/CIExample/workspace - hudson.remoting.LocalChannel@3861e6
Using strategy: Default
Checkout:workspace / /home/tomcat/.hudson/jobs/CIExample/workspace - hudson.remoting.LocalChannel@3861e6
GitAPI created
Cloning the remote Git repository
Cloning repository origin
$ git clone -o origin https://[email protected]/mattupstate/CIExample.git /home/tomcat/.hudson/jobs/CIExample/workspace
ERROR: Error cloning remote repo 'origin' : Could not clone https://[email protected]/mattupstate/CIExample.git
ERROR: Cause: Error performing git clone -o origin https://[email protected]/mattupstate/CIExample.git /home/tomcat/.hudson/jobs/CIExample/workspace
Trying next repository
ERROR: Could not clone from a repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:587)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:535)
    at hudson.FilePath.act(FilePath.java:753)
    at hudson.FilePath.act(FilePath.java:735)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:535)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1044)
    at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:479)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:411)
    at hudson.model.Run.run(Run.java:1257)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:127)

The build doesn't hang at all like some people report. It instantly fails. Additionally, if I log into my box, switch to the tomcat user (the user running Tomcat and thus Hudson), and run this command:

git clone -o origin https://[email protected]/mattupstate/CIExample.git /home/tomcat/.hudson/jobs/CIExample/workspace

It runs with no problems and the repo is cloned. The only problem I've run into running that command manually is if the workspace folder already exits. Git doesn't like it when the local folder I want to clone to already exists. I have a feeling Hudson is creating that folder before the clone is attempted?

Any help would be appreciated.

A: 

Did you check your path when your Hudson job server execute and tries to call git commands?
See the "Gotcha" section of the Git Hudson plugin.

If you are seeing output indicating Git could not clone, something like the output below, go to to the Hudson configuration settings (not the project settings, the global ones) and change the Git path to a fully qualified path (eg. not "git" but "/usr/bin/git" or wherever your Git binary is installed).
You should also verify that the permissions are correct if you are doing a file system based clone.

VonC
Yeah, I've tried setting the git executable to its fully qualified path...$ /usr/bin/git clone -o origin https://[email protected]/mattupstate/CIExample.git /home/tomcat/.hudson/jobs/CIExample/workspaceresults in the same error.
Matt W
@Matt W: then try also to explicitly setup the $HOME environment variable, like in http://stackoverflow.com/questions/3188710/hudson-git-plugin-not-working-on-windows/3188786#3188786 or http://stackoverflow.com/questions/3182012/problem-with-hudson-git-gitosis-on-windows (even if those answers were for Windows, the same principle applies here)
VonC
the HOME environment variable already exists for the tomcat user. 'echo $HOME' outputs '/home/tomcat'. No problem there. Additionally, the public key files for git exist in the .ssh folder.
Matt W
@Matt W: The all point is to setup that `$HOME` environment variable within the Hudson configuration setting, instead of relying on the shell environment (just no be extra sure here: worth a try). A bit like http://tech.efreedom.com/Question/1-2447878/How-to-configure-Hudson-and-git-plugin-with-an-SSH-key, where the keys were actually looked for not in the right place.
VonC
@Matt W: at least, the `$HOME` setting worked for Jako ;) http://stackoverflow.com/questions/3188710/hudson-git-plugin-not-working-on-windows/3188786#3188786
VonC
Didn't work for me :(
Matt W