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

后端 未结 8 1070
走了就别回头了
走了就别回头了 2020-12-13 20:06

I have successfully cloned Git repository in Jenkins over Git/SSH on Windows 2008 32-bit. When I tried to do the same on Windows 2008 64-bit, Console Output page ge

相关标签:
8条回答
  • 2020-12-13 20:33

    https://wiki.jenkins-ci.org/display/JENKINS/GitHub+Plugin

    Just add a ssh-enabled user logon to Jenkins and it should work smoothly.

    0 讨论(0)
  • 2020-12-13 20:41

    Another issue i faced with was, ssh.exe was not looking at the %userprofile%/.ssh folder for the key files. Instead it was looking to the folder C:\Program Files (x86)\Git\.ssh which was empty and which causes a hang due to ssh authentication prompt on the machine where git repo located.

    We just copied the key files under %userprofile%/.ssh to C:\Program Files (x86)\Git\.ssh and the problem is resolved.

    0 讨论(0)
  • 2020-12-13 20:42

    Notes from a hard learned lesson. I had problems getting the ssh to work running Jenkins as a named user account for ssh+git.

    Here is what I had to do to solve the problem:

    1. Generate the key using ssh-keygen (note where they are located)
    2. Set "HOME" to this location

    I tried with puttygen and GET_SSH=plink that all failed very bad but no clear errors.

    0 讨论(0)
  • 2020-12-13 20:44

    When you have to use any configuration options from a per-user configuration file eg. ~/.ssh/config you can put them in C:\Program Files (x86)\Git\etc\ssh\ssh_config, the key files can be put in C:\Program Files (x86)\Git.ssh

    0 讨论(0)
  • 2020-12-13 20:45

    I've gone through these pains recently. Especially frustrating is the lack of error logs in this scenario: probably because MSysgit prompts user on the console when trying to recover - which doesn't get through Jenkins console.

    Based on my experience here are a few key elements to watch for:

    1. a mix of both Msysgit and Cygwin installed: MSysgit worked better for me- but I assume you're using that too
    2. some people have more luck with <MSYSGIT_ROOT>\cmd\git.cmd than <MSYSGIT_ROOT>\bin\git.exe
    3. making sure your slave runs as the same user (which is not the default upon service-based installs).. - oh I see you got that too
    4. setting HOME variable for windows slaves explicity
    5. basically make sure the same .ssh keys are reached when under Jenkins.
    6. for debugging, I found it useful to create a test job with no SCM, but run git clone in an "Execute shell/batch" build step. That should reveal a bit more info. BTW, you can do an env in the same step and maybe ls %HOME%/.ssh

    I think the above is what gave me a working a Windows 7 64bit Jenkins slave with git support - although I thought this had more to do with some other fine config detail than with 64 vs 32 bits. Good luck anyhow!

    0 讨论(0)
  • 2020-12-13 20:46

    In the latest version of git, had to use %GIT_HOME%/cmd/git.exe, rather than %GIT_HOME%/bin/git.exe and figuring out the home directory of the user running the jenkins service.

    0 讨论(0)
提交回复
热议问题