Where I got the info to make this work, Bjorn, is from the thread that your thread referenced:
https://stackoverflow.com/questions/56809684/git-clone-in-jenkins-with-personal-access-token-idles-forever/61104603#61104603 It was a bit painful, but at least it gets it done. What I've implemented is passing the workspace to the checkout, checking out as my user to my user workspace (home directory), moving the files checked out to the jenkins workspace, using sudo to chown the folder and files to be owned by the jenkins user. It's very crude but it works. I'm going to take a look at Mark's option above, but at least I found something that will work... On Mon, Mar 29, 2021 at 7:14 AM eric....@gmail.com <eric.fet...@gmail.com> wrote: > Yes Bjorn, that's the thread I used to figure out how to use the access > token. Unfortunately, the jenkins plugin isn't smart enough to pass a > username, it uses the username it runs as. So my master node is running as > the user "jenkins" so it tries to authenticate to GitHub Enterprise as > jenkins:<myToken which of course fails. So I created a different node to > run as my user, which thankfully, is the same username as I have in GitHub > Enterprise. Smoke and mirrors... > > On Monday, March 29, 2021 at 3:26:47 AM UTC-6 ice...@googlemail.com wrote: > >> Did you try to use credentials in jenkins to store the token instead of >> fiddling with token on the machine? >> See e.g. >> https://stackoverflow.com/questions/61105368/how-to-use-github-personal-access-token-in-jenkins >> >> >> Then you could do everything in one job instead of doing some copy-magic >> (which would horribly break once you start to use more nodes). >> >> Björn >> eric....@gmail.com schrieb am Samstag, 27. März 2021 um 04:05:44 UTC+1: >> >>> Thanks Mark, I'll check it out. Has to beat the hokey workaround I >>> worked up. :) >>> >>> >>> >>> Sent from my T-Mobile 4G LTE Device >>> >>> >>> -------- Original message -------- >>> From: Mark Waite <mark.ea...@gmail.com> >>> Date: 3/26/21 10:49 PM (GMT-05:00) >>> To: Jenkins Users <jenkins...@googlegroups.com> >>> Subject: Re: GitHub Clone to Different Local Directory >>> >>> Good point. How about the external workspace plugin from GSoC 2016? >>> https://plugins.jenkins.io/external-workspace-manager/ >>> >>> On Fri, Mar 26, 2021 at 8:00 PM eric.fetzer <eric....@gmail.com> wrote: >>> >>>> Thanks for the response Mark.. I'm using freestyle. Doesn't checkout >>>> to a subdirectory only take relative paths? >>>> >>>> >>>> >>>> Sent from my T-Mobile 4G LTE Device >>>> >>>> >>>> -------- Original message -------- >>>> From: Mark Waite <mark.ea...@gmail.com> >>>> Date: 3/26/21 6:44 PM (GMT-05:00) >>>> To: Jenkins Users <jenkins...@googlegroups.com> >>>> Subject: Re: GitHub Clone to Different Local Directory >>>> >>>> If you're using pipeline, change to that directory with the >>>> dir('/users/username/projectname') { } wrapper around the checkout step; >>>> >>>> If you're using a freestyle job, use the git plugin extension 'checkout >>>> to a subdirectory' >>>> <https://plugins.jenkins.io/git/#checkout-to-a-sub-directory> >>>> >>>> On Fri, Mar 26, 2021 at 10:54 AM eric....@gmail.com <eric....@gmail.com> >>>> wrote: >>>> >>>>> OK, so this is kind of complex so hang with me. We're moving from >>>>> StarTeam to Github and I'm trying to reproduce what I'm doing in StarTeam >>>>> with Github. StarTeam was easy because I owned the repository machine as >>>>> well as administrated the tool. With Github, we're hosted. So I'm admin >>>>> on the project but can't create an RSA Token on the machine for easy >>>>> access. So I had to play around to make a personal access token work. In >>>>> order to make that access token work, I had to run the checkout job on a >>>>> different node so that it was running as a user that lived in Github as >>>>> well (access token's namesake). So when this job gets called from the >>>>> jenkins job, I want it to clone to the calling job's workspace >>>>> (/opt/jenkins/workspace/<project_name>). Well since in order to >>>>> authenticate, it lives in it's own shell, the workspace for this guy, and >>>>> where it wants to clone to, is /home/<username>/<project_name>. All that >>>>> for my question: how can I specify what folder to checkout to? I tried >>>>> to >>>>> use "checkout to specific local branch" but it fails saying "is not a >>>>> valid >>>>> branch name". Well, yeah, branch is referring to branch not folder, lol. >>>>> In StarTeam this is easy, you just specify working folder. Any help? >>>>> 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. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/jenkinsci-users/128374b8-63d5-4b8c-86bb-5f214f5e68d2n%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/jenkinsci-users/128374b8-63d5-4b8c-86bb-5f214f5e68d2n%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-use...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtG6VTjt8F7Vj5pJW13VQJTfxCqRuZuDHjj5zZTa3jJ9%3Dg%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtG6VTjt8F7Vj5pJW13VQJTfxCqRuZuDHjj5zZTa3jJ9%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-use...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/jenkinsci-users/605e9199.1c69fb81.932c2.d78c%40mx.google.com >>>> <https://groups.google.com/d/msgid/jenkinsci-users/605e9199.1c69fb81.932c2.d78c%40mx.google.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-use...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtHWfuOvLQubF%2BWHBoExHugTGd_FnmEvh2fHWPMNcH08ZQ%40mail.gmail.com >>> <https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtHWfuOvLQubF%2BWHBoExHugTGd_FnmEvh2fHWPMNcH08ZQ%40mail.gmail.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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/921876ab-23ac-4272-b990-04925cf8352bn%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/921876ab-23ac-4272-b990-04925cf8352bn%40googlegroups.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/CAByBicYf0HetcEGPDKcZ6voFSuFs6yGtrVzaWeZaFxJvSpLneA%40mail.gmail.com.