-1

When using jenkins to build a project, use git pull in the exceute shell,I get the following error:

+ git pull
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Build step 'Execute shell' marked build as failure
Finished: FAILURE

I don't know How to configure git ssh in jenkins.

ANIL
  • 2,542
  • 4
  • 25
  • 44

1 Answers1

1

In my answer I expect authentication to git to be done with SSH keys.

The preferred way to use git in Jenkins is to set it up in the Configuration -> Source Code Management.

Should this not fit your workflow, and you want to use git commands from the shell, you should install the SSH agent plugin. You should set up the SSH key under Configuration -> Build Environment -> SSH agent. All steps in your build will be executed with this SSH key available, so pulling and pushing to git should become possible.

Joep Weijers
  • 1,844
  • 12
  • 19