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 <daniel.koch...@gmail.com> 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 jenkinsci-users+unsubscr...@googlegroups.com.
> 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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtE4EA5QkALtmraRehCa6QmVpJbu1eovjQhoHmDVt%3DauFQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to