Oups my bad, in my hurry I forgot to change the right exe, I keep those into variable and I badly refilled them here:
sh("ssh-keygen -R ${domain} -f \".ssh/known_hosts\"") sh("ssh-keyscan -t rsa ${domain} >> \".ssh/known_hosts\"") The first one removes any old entry, the second one adds the record to the file. Jérôme Godbout, B. Ing. Software / Firmware Team Lead O: (418) 682-3636 ext.: 114 C: (581) 777-0050 godbo...@dimonoff.com<mailto:godbo...@dimonoff.com> [signature_796898478]<https://www.dimonoff.com/> dimonoff.com<https://www.dimonoff.com/> 1015 Avenue Wilfrid-Pelletier, Québec, QC G1W 0C4, 4e étage From: jenkinsci-users@googlegroups.com <jenkinsci-users@googlegroups.com> on behalf of Eric Fetzer <eric.fet...@gmail.com> Date: Tuesday, March 30, 2021 at 10:15 AM To: jenkinsci-users@googlegroups.com <jenkinsci-users@googlegroups.com> Subject: Re: GitHub Clone to Different Local Directory So the url is git@a.b.c.d and I tried to use your first command with a.b.c.d for domain and got "bad remote forwarding specification". I tried it with b.c.d and c.d as well resulting in the same error. Any ideas? Thanks! On Mon, Mar 29, 2021 at 2:06 PM Jérôme Godbout <godbo...@amotus.ca<mailto:godbo...@amotus.ca>> wrote: I do add the domain and hsot to my known host file before to avoid that nasty confirm: sh("ssh -R ${domain} -f \".ssh/known_hosts\"") sh("ssh -t rsa ${domain} >> \".ssh/known_hosts\"") that should do the trick and avoid that prompt when later used. Use the domain of the repos url domain. Jérôme Godbout, B. Ing. Software / Firmware Team Lead O: (418) 682-3636 ext.: 114 C: (581) 777-0050 godbo...@dimonoff.com<mailto:godbo...@dimonoff.com> [signature_168530195]<https://www.dimonoff.com/> dimonoff.com<https://www.dimonoff.com/> 1015 Avenue Wilfrid-Pelletier, Québec, QC G1W 0C4, 4e étage From: jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com> <jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com>> on behalf of eric....@gmail.com<mailto:eric....@gmail.com> <eric.fet...@gmail.com<mailto:eric.fet...@gmail.com>> Date: Monday, March 29, 2021 at 3:27 PM To: Jenkins Users <jenkinsci-users@googlegroups.com<mailto:jenkinsci-users@googlegroups.com>> Subject: Re: GitHub Clone to Different Local Directory The only thing I can guess is that ssh is getting a question when he attempts to connect wanting to be added to the known_hosts file. Wondering if maybe there's a way to establish this if this is indeed the issue? On Monday, March 29, 2021 at 12:07:01 PM UTC-6 eric....@gmail.com<mailto:eric....@gmail.com> wrote: Thanks Mark! I believe I'm one step closer but it's still not working. I'm now getting: Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git@myURLRepo:myUser/myProject.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: stdout: stderr: ssh: connect to host myURLRepo port 22: Connection timed out fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. On Monday, March 29, 2021 at 11:23:28 AM UTC-6 Mark Waite wrote: You can't use ssh authentication with an https repository URL. When using ssh authentication, you need to use an ssh repository URL. When using username / password or username / token, you must use an HTTPS (or HTTP) URL. Mark Waite On Mon, Mar 29, 2021 at 10:38 AM Eric Fetzer <eric....@gmail.com<mailto:eric....@gmail.com>> wrote: Hmmm, thought that was going to work but it didn't. I followed everything to a T at: https://mohitgoyal.co/2017/02/27/configuring-ssh-authentication-between-github-and-jenkins/ The output shows: Building on master in workspace /var/lib/jenkins/workspace/Git-Checkout using credential JenkinsSSHKey > git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url > https://m<https://code.fs.usda.gov/ericfetzer/iNAP.git>yGitRepo.git # > timeout=10 Cleaning workspace > git rev-parse --verify HEAD # timeout=10 No valid HEAD. Skipping the resetting > git clean -fdx # timeout=10 Fetching upstream changes from https://m<https://code.fs.usda.gov/ericfetzer/iNAP.git>yGitRepo.git > git --version # timeout=10 using GIT_SSH to set credentials So I see it's using the creds. Then when it tries to do the fetch, it says: > git fetch --tags --progress > https://m<https://code.fs.usda.gov/ericfetzer/iNAP.git>yGitRepo.git > +refs/heads/*:refs/remotes/origin/* # timeout=10 ERROR: Error fetching remote repo 'origin' hudson.plugins.git.GitException: Failed to fetch from https://m<https://code.fs.usda.gov/ericfetzer/iNAP.git>yGitRepo.git at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:909) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1131) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1167) at hudson.scm.SCM.checkout(SCM.java:505) at hudson.model.AbstractProject.checkout(AbstractProject.java:1206) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:637) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:509) at hudson.model.Run.execute(Run.java:1907) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress https://m<https://code.fs.usda.gov/ericfetzer/iNAP.git>yGitRepo.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: stdout: stderr: remote: Password authentication is not available for Git operations. remote: You must use a personal access token or SSH key. On Mon, Mar 29, 2021 at 8:09 AM Eric Fetzer <eric....@gmail.com<mailto:eric....@gmail.com>> wrote: Ohhhh, duh, I get it now. I create the key with the jenkins user and add id_rsa.pub to the GitHub account for access. I was somehow thinking I would need a key on the GitHub side. Feeling kind of foolish now, lol. Thanks Dirk! On Mon, Mar 29, 2021 at 7:52 AM 'Dirk Heinrichs' via Jenkins Users <jenkins...@googlegroups.com<mailto:jenkins...@googlegroups.com>> wrote: Am Montag, den 29.03.2021, 07:44 -0600 schrieb Eric Fetzer: Thanks for your reply Dirk! I'm a unix guy and that would have been my first choice, however I don't have access to the GitHub OS, only my particular repositories. I don't understand. Nobody has this kind of access. But everybody can add SSH keys to their GH account (using the web UI). Bye... Dirk -- Dirk Heinrichs Senior Systems Engineer, Delivery Pipeline OpenText ™ Discovery | Recommind Phone: +49 2226 15966 18<tel:+49%202226%201596618> Email: dhei...@opentext.com<mailto:dhei...@opentext.com> Website: www.recommind.de<http://www.recommind.de> Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan, Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646 This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet. -- 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/Ob42FqU-0UY/unsubscribe. To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com<mailto:jenkinsci-use...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/7363fbe30406b54bee9b6671dc9754cbf78081c7.camel%40opentext.com<https://groups.google.com/d/msgid/jenkinsci-users/7363fbe30406b54bee9b6671dc9754cbf78081c7.camel%40opentext.com?utm_medium=email&utm_source=footer>. -- 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<mailto:jenkinsci-use...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAByBicb7irzVcbgHO0vV39EE7f515%3DVCkcHqrYE5eefkjbZT%3Dg%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CAByBicb7irzVcbgHO0vV39EE7f515%3DVCkcHqrYE5eefkjbZT%3Dg%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- 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<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/578014bd-9a78-49c9-99fb-2b0ab66c2354n%40googlegroups.com<https://groups.google.com/d/msgid/jenkinsci-users/578014bd-9a78-49c9-99fb-2b0ab66c2354n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- 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/Ob42FqU-0UY/unsubscribe. To unsubscribe from this group and all its topics, send an email to jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/QB1PR01MB38441677B7426D136A949FBFCD7E9%40QB1PR01MB3844.CANPRD01.PROD.OUTLOOK.COM<https://groups.google.com/d/msgid/jenkinsci-users/QB1PR01MB38441677B7426D136A949FBFCD7E9%40QB1PR01MB3844.CANPRD01.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer>. -- 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<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAByBicbOCiWvNLhhATFmhKAH0YPsB%3DZUDCbAHESpK9grnya1WQ%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CAByBicbOCiWvNLhhATFmhKAH0YPsB%3DZUDCbAHESpK9grnya1WQ%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/QB1PR01MB3844E30F21F2D7759011267ECD7D9%40QB1PR01MB3844.CANPRD01.PROD.OUTLOOK.COM.