Hi Mark,

Yes. You mean this <https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin> 
one? I also tried this and get the following error:
Failed to connect to repository : Command "/usr/local/bin/git -c 
core.askpass=true ls-remote -h ssh://git@<host>:7999/<repository>.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.

I think the error itself is clear but I am pretty sure that I add the the 
user to the "Access keys" in Bitbucket server.

Thanks,
Daniel

Am Mittwoch, 11. Mai 2016 13:16:20 UTC+2 schrieb Mark Waite:
>
> Rather than preform the got fetch in a shell script,  you will have better 
> luck with the git plugin. It allows you to define the repository and 
> credentials,  then it does the work
>
> On Tue, May 10, 2016, 11:18 PM Daniel Koch <[email protected] 
> <javascript:>> wrote:
>
>> Hi,
>>
>> I want to setup a simple Jenkins job for managing (f.e. updating) my 
>> existing remote git repository (Bitbucket server) with the following 
>> criterias:
>>
>>    - Authentication on the remote using ssh key authentication
>>    - Git authentication using configured access key
>>
>> I installed the following plugins:
>> Setup SSH Agent Plugin (ssh-agent 
>> <https://wiki.jenkins-ci.org/display/JENKINS/SSH+Agent+Plugin>)
>> SSH plugin (ssh 
>> <https://wiki.jenkins-ci.org/display/JENKINS/SSH+Agent+Plugin>)
>>
>> What I did so far:
>>
>>    1. Configure ssh key identity to login to the remote maschine 
>>    (private key, password)
>>    2. Configure a SSH host for the remote under "Manage Jenkins"
>>    3. Configure a Jenkins job with "Build Environment": Selecting the 
>>    configured ssk key (1.) under "SSH Agent"
>>    4. Under "Build" I add a "Execute shell script on remote host using 
>>    ssh". Here I add for example git fetch
>>    5. I also add the public key on the remote under authorized_keys
>>    6. On Bitbucker server I add the ssh public key as an "Access key"
>>
>> What happens if I "run" the job:
>> Started by user <Jenkins username>
>> Building in workspace <path>/workspace/<Jenkins job>
>> [ssh-agent] Looking for ssh-agent implementation...
>> [ssh-agent] Java/JNR ssh-agent
>> [ssh-agent] Started.
>> [ssh-agent] Using credentials <ssh key user from 1.>
>> executing script:
>>
>> git fetch
>> Permission denied (publickey).
>> fatal: The remote end hung up unexpectedly
>> [SSH] exit-status: 128
>> Build step 'Execute shell script on remote host using ssh' marked build 
>> as failure
>> [ssh-agent] Stopped.
>> Finished: FAILURE
>>
>> I think the problem is the proper authentication against the git 
>> repository. I would expect here that the job is using the identity of the 
>> configured ssh key identity?!
>>
>> Thanks,
>> Daniel
>>
>> -- 
>> 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/3312a938-ffd7-4872-820b-591a8b855581%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/3312a938-ffd7-4872-820b-591a8b855581%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/7e9378a7-ab74-4a23-8182-35fd3ff332c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to