That worked, thank you! The `git clone` command I copied from my Dockerfile 
seemed to require ssh but this one does not.

On Monday, March 30, 2020 at 12:44:12 PM UTC-4, Sat wrote:
>
>
>
> below worked for me, i never tried ssh:
> git@repourl/reponame.git
>
>
>
> On Monday, March 30, 2020 at 5:34:17 PM UTC+1, Alex M wrote:
>>
>> Hello, I’m trying to set up a Jenkins Pipeline that pulls from a git 
>> repository on a remote server. I’m getting an authentication error when 
>> using “Pipeline script from SCM” but the same credentials work in my 
>> freestyle project using sshagent() and git clone. It also succeeds when 
>> verifying that the repo exists on the configure page.
>>
>>  
>>
>> When I run the build for this Pipeline I get “Permission denied 
>> (publickey,password)” (full output below). The file permissions and repo 
>> appear to be ok as the freestyle project succeeds. I’ve tried using ssh 
>> keys with a password and without a password and unselected “Lightweight 
>> checkout”. Jenkins is running locally (i.e. not in a container). What could 
>> be causing this?
>>
>>  
>>
>> Thank you.
>>
>>
>>
>> Jenkins pipeline configuration: 
>>
>>
>> [image: jenkins_pipeline_config.png]
>>
>>
>>
>>  
>>
>> Pipeline output:
>>
>> Started by user admin
>>
>> Checking out git ssh://jenkins@<remote_server>/home/jenkins/cadh into 
>> /var/lib/jenkins/workspace/cadh_pipeline@script to read Jenkinsfile
>>
>> using credential jenkins2
>>
>> > git rev-parse --is-inside-work-tree # timeout=10
>>
>> Fetching changes from the remote Git repository
>>
>> > git config remote.origin.url 
>> ssh://jenkins@<remote_server>/home/jenkins/cadh # timeout=10
>>
>> Fetching upstream changes from 
>> ssh://jenkins@<remote_server>/home/jenkins/cadh
>>
>> > git --version # timeout=10
>>
>> > git fetch --tags --force --progress -- 
>> ssh://jenkins@<remote_server>/home/jenkins/cadh 
>> +refs/heads/*:refs/remotes/origin/* # timeout=10
>>
>> ERROR: Error fetching remote repo 'origin'
>>
>> hudson.plugins.git.GitException: Failed to fetch from 
>> ssh://jenkins@<remote_server>/home/jenkins/cadh
>>
>>                 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 
>> org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
>>
>>                 at 
>> org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:155)
>>
>>                 at 
>> org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:69)
>>
>>                 at 
>> org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:303)
>>
>>                 at 
>> hudson.model.ResourceController.execute(ResourceController.java:97)
>>
>>                 at hudson.model.Executor.run(Executor.java:428)
>>
>> Caused by: hudson.plugins.git.GitException: Command "git fetch --tags 
>> --force --progress -- ssh://jenkins@<remote_server>/home/jenkins/cadh 
>> +refs/heads/*:refs/remotes/origin/*" returned status code 128:
>>
>> stdout: 
>>
>> stderr: Permission denied, please try again.
>>
>> Permission denied, please try again.
>>
>> jenkins@<remote_server>: Permission denied (publickey,password).
>>
>> fatal: Could not read from remote repository.
>>
>>  
>>
>> Please make sure you have the correct access rights
>>
>> and the repository exists.
>>
>>  
>>
>>                 at 
>> org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2430)
>>
>>                 at 
>> org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2044)
>>
>>                 at 
>> org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:81)
>>
>>                 at 
>> org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:569)
>>
>>                 at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:907)
>>
>>                 ... 8 more
>>
>> ERROR: Error fetching remote repo 'origin'
>>
>> ERROR: Maximum checkout retry attempts reached, aborting
>>
>> Finished: FAILURE
>>
>>  
>>
>>  
>>
>>  
>>
>> Auth logs on the remote server: 
>>
>> Mar 30 11:02:00 <remote_server> sshd[19725]: Connection from 
>> <jenkins_server> port 57718 on <local IP> port 22
>>
>> Mar 30 11:02:00 <remote_server> sshd[19725]: Failed none for jenkins from 
>> <jenkins_server> port 57718 ssh2
>>
>> Mar 30 11:02:00 <remote_server> sshd[19725]: Failed password for jenkins 
>> from <jenkins_server> port 57718 ssh2
>>
>> Mar 30 11:02:00 <remote_server> sshd[19725]: Failed password for jenkins 
>> from <jenkins_serve> port 57718 ssh2
>>
>> Mar 30 11:02:00 <remote_server> sshd[19725]: Connection closed by 
>> authenticating user jenkins <jenkins_server> port 57718 [preauth]
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>

-- 
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/9ebc706b-3465-4c41-93bd-95e2b4c5e9a8%40googlegroups.com.

Reply via email to