Home > Software engineering >  Pushing git tag to ssh protocol type link failes in jenkins
Pushing git tag to ssh protocol type link failes in jenkins

Time:04-29

I have a repo: https://github.com/Elydasian/gatling-example

I have a pipeline in jenkins ready, that checks out that repo, and after some building and whatnot, I want to tag the branch.

I made a "SSH Username with private key" credentials and added it to my jenkins pipeline Now, I am finished doing what I needed with it (I checkout the project)

Now I need to be able to TAG it. For that, I have done the following lines:

git tag TAG_NAME
git remote set-url --push origin [email protected]:Elydasian/gatling-example.git 
git push origin TAG_NAME

Then, it throws an error:

[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Can you help me?

CodePudding user response:

You need to make sure the right key is read.

From your last question, that what sh 'GIT_SSH_COMMAND = "ssh -i $key"' was for in the withCredentials step.

In your case, try git -c core.sshCommand='ssh -Tv' push origin TAG_NAME instead of just git push, in order to see what key it is trying to use.

  • Related