Alternately, couldn't you generate a private key which does not require a passphrase and use that instead?
There is at least one bug logged against the git plugin or the git client plugin that declares it does not support private keys which require a passphrase. Refer to https://issues.jenkins-ci.org/browse/JENKINS-20879 Mark Waite On Mon, May 26, 2014 at 10:43 AM, John Meloro <john.mel...@gmail.com> wrote: > So, more troubleshooting... > > I am able to successfully run the following command, using Git Bash, from > the directory that contains my cloned repository. > > git.exe fetch --tags --progress g...@github.com:jmeloro/game-of-life.git > +refs/heads/*:refs/remotes/origin/* > > The "catch" is that I am prompted for the pass phrase! > > I suspect that what is happening is that "behind the scenes" a pass phrase is > being requested > > and since it never gets entered a timeout occurs. > > So, the next step is to trouble shoot the credentials plugin. > > > > > On Sun, May 25, 2014 at 6:39 PM, Stephen Connolly < > stephen.alan.conno...@gmail.com> wrote: > >> But are you selecting a credential who's username is git and who's >> private key is the key you want Jenkins to access with? >> >> Until you select that credential you will - correctly - see the warning. >> >> If you can't see the credentials drop down then upgrade the git plugin to >> at least the 2.x >> >> On Sunday, 25 May 2014, <john.mel...@gmail.com> wrote: >> >>> Okay, I re-attempting to configure my Jenkins correctly. >>> >>> Here is where I am coming off the rails: >>> >>> >>> - When I leave out the "git@" in the SCM URL in the Source Code >>> Management section, I immediately get the following error: >>> >>> >>> - "Failed to connect to repository : Command "git.exe ls-remote -h >>> github.com:jmeloro/game-of-life.git HEAD" returned status code >>> 128: >>> - stdout: >>> - stderr: Permission denied (publickey). >>> >>> >>> - fatal: Could not read from remote repository. >>> >>> >>> - Please make sure you have the correct access rights >>> - and the repository exists. >>> >>> Likewise when I attempt to run the following command in gitBash: >>> >>> $ git.exe ls-remote -h github.com:jmeloro/game-of-life.git HEAD >>> Permission denied (publickey). >>> fatal: Could not read from remote repository. >>> >>> Please make sure you have the correct access rights >>> and the repository exists. >>> >>> So, I am thinking that my public/private keys are still not setup >>> correctly. >>> >>> Any help will be appreciated. >>> >>> Thanks, >>> >>> >>> >>> On Sunday, May 11, 2014 5:33:37 PM UTC-4, Stephen Connolly wrote: >>>> >>>> You should enter the username as git and not put the git@ in the scm >>>> url. >>>> >>>> What is happening is that github expects that the username for your key >>>> will *always* be "git". When you specify a username in an ssh key, the git >>>> plugin then replaces the git@ with your username... so despite the >>>> fact that my github username is stephenc I put the username of the private >>>> key my jenkins uses to connect to github as "git" and it should all "just >>>> workâ˘" >>>> >>>> HTH >>>> >>>> >>>> On 11 May 2014 17:45, <john....@gmail.com> wrote: >>>> >>>>> Thank You for the prompt response! >>>>> >>>>> I've been struggling with this, off and on, for a couple of weeks now >>>>> and am very grateful for any guidance. >>>>> >>>>> So, with that in mind, and in the hopes I can get my installation >>>>> correct, I'm starting with a completely clean install. I've removed the >>>>> old instance of Jenkins locally and even removed the old keys from my git >>>>> account. >>>>> >>>>> Here are the steps, I am following: >>>>> >>>>> 1) Downloaded the latest Jenkins 1.562.zip >>>>> 2) Installed to C:\Jenkins (because in my experience "Program Files" >>>>> with a space in the middle is problematic) >>>>> 3) Installed the Git Client Plugin 1.10 from the Manage Plugins page >>>>> under Manage Jenkins >>>>> 4) Went to https://help.github.com/articles/generating-ssh-keys and >>>>> followed the instructions to generate new keys >>>>> 4a) Note: I had already installed GitBash and so performed all the >>>>> following steps in a command window opened from Git Bash. >>>>> 4b) Note: When executing ssh-add ~/.ssh/id_rsa I got the error message >>>>> "Could not open a connection to your authentication agent." >>>>> (Not sure if that is a show stopper for Jenkins, so I pressed >>>>> on.) >>>>> 5) Ran the following steps to add my new SSH keys to GitHub >>>>> 5a) "clip < ~/.ssh/id_rsa.pub" >>>>> 5b) Logged into my GitHib account, using the link: >>>>> https://help.github.com/articles/generating-ssh-keys, and added my >>>>> new key to my account. >>>>> 6) Testing results: >>>>> $ ssh -T g...@github.com >>>>> The authenticity of host 'github.com (192.30.252.128)' can't be >>>>> established. >>>>> RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b: >>>>> 56:4d:eb:df:a6:48. >>>>> Are you sure you want to continue connecting (yes/no)? yes >>>>> Warning: Permanently added 'github.com,192.30.252.128' (RSA) to >>>>> the list of known hosts. >>>>> Enter passphrase for key '/c/Users/xxxxxx/.ssh/id_rsa': >>>>> Hi john...! You've successfully authenticated, but GitHub does >>>>> not provide shell access. >>>>> 7) Returned to my Git Bash Window and forked the sample repository >>>>> using the following command: >>>>> git clone g...@github.com:xxxx-xxxxxx/game-of-life.git >>>>> 7a) $ git clone g...@github.com:john-meloro/game-of-life.git >>>>> Cloning into 'game-of-life'... >>>>> Warning: Permanently added the RSA host key for IP address >>>>> '192.30.252.130' to the list of known hosts. >>>>> Enter passphrase for key '/c/Users/xxxxxx/.ssh/id_rsa': >>>>> remote: Reusing existing pack: 9139, done. >>>>> remote: Total 9139 (delta 0), reused 0 (delta 0) >>>>> Receiving objects: 100% (9139/9139), 17.34 MiB | 849.00 KiB/s, >>>>> done. >>>>> Resolving deltas: 100% (5704/5704), done. >>>>> Checking connectivity... done. >>>>> Checking out files: 100% (1518/1518), done. >>>>> 8) Next, I went back to Jenkins. I have already installed Java 1.7 >>>>> and Maven 3.x installed locally so I used them in my Jenkins configuration >>>>> in lieu of >>>>> downloading new installations. >>>>> 9) Setting up my Jenkins build job went like this: >>>>> 9a) Clicked "New Item" from "Configure Jenkins" >>>>> 9b) Selected " >>>>> >>>>> *Build a free-style software project" (As per the instructions in >>>>> Jenkins: The definitive Guide" 9c) Now comes the interesting part!9d) >>>>> Under >>>>> "* >>>>> *Source Code Management"9e) Selected Git; Git Repositories; *Repository >>>>> URL: g...@github.com:xxxx-xxxxx/game-of-life.git >>>>> 9f) But got the following error before I could complete the >>>>> configuration: >>>>> Failed to connect to repository : Command "git.exe ls-remote -h >>>>> g...@github.com:john-meloro/game-of-life.git HEAD" returned status >>>>> code 128: >>>>> stdout: >>>>> stderr: Permission denied (publickey). >>>>> fatal: Could not read from remote repository. >>>>> >>>>> Please make sure you have the correct access rights >>>>> and the repository exists. >>>>> 9g) However, I did add the following under "Add Credentials" >>>>> Kind: SSH Username with private key >>>>> Username: xxxx-xxxxxx >>>>> Description: SSH Username with private key >>>>> Private Key: (tried all three options) >>>>> Pass Phrase: (Entered the correct pass phrase) >>>>> >>>>> And that is about as far as I'm getting. >>>>> >>>>> Any help would be appreciated. >>>>> >>>>> Thanks. >>>>> On Sunday, May 11, 2014 9:58:48 AM UTC-4, Mark Waite wrote: >>>>>> >>>>>> You will probably have a better chance of success if you update your >>>>>> credentials plugin to the latest version, register your private key in >>>>>> the >>>>>> "Manage Jenkins", "Manage Credentials" section, then use that registered >>>>>> credential with your job. That has the benefit that the private key is >>>>>> managed by Jenkins and will be used on slaves and masters as needed. >>>>>> >>>>>> You could also try the same operations without installing git at all, >>>>>> if you use "Manage Jenkins" to add "JGit" as an installation of git. The >>>>>> JGit implementation is not yet at functional parity with the command >>>>>> implementation, but it is pure Java so the use cases which it handles are >>>>>> all handled in Java, without requiring installation of a separate >>>>>> program. >>>>>> >>>>>> I believe that "Jenkins the Definitive Guide" was published before >>>>>> the Credentials plugin was used by the git plugin. >>>>>> >>>>>> Mark Waite >>>>>> >>>>>> >>>>>> On Sun, May 11, 2014 at 6:38 AM, <john....@gmail.com> wrote: >>>>>> >>>>>>> Okay, I am a newbie to Jenkins. >>>>>>> >>>>>>> I'm reading Jenkins: The Definitive >>>>>>> Guide<http://isbn.directory/book/978-1-4493-0535-2>and am attempting to >>>>>>> set up the first example. >>>>>>> >>>>>>> I'm having issues and I've searched and haven't really found an >>>>>>> answer. >>>>>>> >>>>>>> So, I am posting here in the hopes that this is a simple >>>>>>> configuration issue. >>>>>>> >>>>>>> I've done the following: >>>>>>> >>>>>>> - Set up Jenkins as a windows service and installed the Git >>>>>>> Plugin >>>>>>> - Used Git-Bash to open a window and create the key pair >>>>>>> - Copied the public key to my Git account >>>>>>> - Cloned the Git repository as directed in the book's example >>>>>>> >>>>>>> However, I am seeing the following error message each time Jenkins >>>>>>> attempts to pull changes from the Git repository: >>>>>>> >>>>>>> Started by an SCM change: >>>>>>> >>>>>>> Building in workspace C:\Jenkins\workspace\game-of-life-default >>>>>>> git.exe rev-parse --is-inside-work-tree >>>>>>> Fetching changes from the remote Git repository >>>>>>> git.exe config remote.origin.url >>>>>>> g...@github.com:xxxx-xxxxxx/game-of-life.git >>>>>>> Fetching upstream changes from >>>>>>> g...@github.com:xxxx-xxxxx/game-of-life.git >>>>>>> git.exe --version >>>>>>> git.exe fetch --tags --progress >>>>>>> g...@github.com:xxxx-xxxxx/game-of-life.git >>>>>>> +refs/heads/*:refs/remotes/origin/* >>>>>>> >>>>>>> ERROR: Timeout after 10 minutes >>>>>>> >>>>>>> FATAL: Failed to fetch from g...@github.com:xxxx-xxxxx/game-of-life.git >>>>>>> >>>>>>> hudson.plugins.git.GitException: Failed to fetch from >>>>>>> g...@github.com:xxxx-xxxxx/game-of-life.git >>>>>>> >>>>>>> Finally returning with a status code: -1. >>>>>>> >>>>>>> Any help would be appreciated. >>>>>>> >>>>>>> Thanks >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "Jenkins Users" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to jenkinsci-use...@googlegroups.com. >>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Thanks! >>>>>> Mark Waite >>>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Jenkins Users" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to jenkinsci-use...@googlegroups.com. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Jenkins Users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to jenkinsci-users+unsubscr...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> -- >> Sent from my phone >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Jenkins Users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/jenkinsci-users/P8mAVI9cROU/unsubscribe >> . >> To unsubscribe from this group and all its topics, send an email to >> jenkinsci-users+unsubscr...@googlegroups.com. >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jenkinsci-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Thanks! Mark Waite -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.