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, <[email protected]> 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 [email protected] > 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 [email protected]:xxxx-xxxxxx/game-of-life.git > 7a) $ git clone [email protected]: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: [email protected]: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 > [email protected]: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, <[email protected]> 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 >>> [email protected]:xxxx-xxxxxx/game-of-life.git >>> Fetching upstream changes from [email protected]:xxxx-xxxxx/game-of-life.git >>> git.exe --version >>> git.exe fetch --tags --progress >>> [email protected]:xxxx-xxxxx/game-of-life.git >>> +refs/heads/*:refs/remotes/origin/* >>> >>> ERROR: Timeout after 10 minutes >>> >>> FATAL: Failed to fetch from [email protected]:xxxx-xxxxx/game-of-life.git >>> >>> hudson.plugins.git.GitException: Failed to fetch from >>> [email protected]: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 [email protected]. >>> 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 [email protected]. > 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
