If you're running an outdated version of the git client plugin and a newer version of OpenSSH (7.7 and later), then you might be encountering https://issues.jenkins-ci.org/browse/JENKINS-50573 . Git plugin versions prior to
If you're running the current git client plugin (2.8.6) or running an OpenSSH older than 7.7, then you might be mistakenly using an http or https protocol URL. The ssh protocol is either ssh://hostname/dir/path or username@hostname:dir/path. `git remote -v` will report the URL of the remote in that repository. On Tue, Sep 17, 2019 at 4:27 AM DexterMagnific <said.lan...@gmail.com> wrote: > Hi all, > > I have big troubles making 'git' commands inside a pipeline file. > > I have the following command: > > stage('Download test database') { > steps { > sshagent(credentials: ['aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee']) > {*/ > sh 'git submodule update --init --recursive' > } > } > } > > The problem is that git is called with the user 'jenkins' instead of the > one that is specified inside the credential (which is 'jenkins-serv') I get > a "permission denied" from the git server. > > [Pipeline] // stage > [Pipeline] stage > [Pipeline] { (Download test database) > [Pipeline] sh > + git submodule update --init --recursive > Cloning into '/var/lib/jenkins/workspace/MyProject/testDB'... > jenkins@192.168.20.23: Permission denied (publickey). > fatal: Could not read from remote repository. > > > Did I miss something on the pipeline setup ? > > 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-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/b5f85d92-adfd-496c-b7c8-2d7a34ad4b21%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/b5f85d92-adfd-496c-b7c8-2d7a34ad4b21%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Thanks! Mark Waite -- 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/CAO49JtFoQhjChuG5k7FLL3_tjGQNQsvWMFtupKLAdT7pOhTvTQ%40mail.gmail.com.