Nitin Dagdi
Nitin Dagdi

Reputation: 57

Jfrog pipeline Service- Getting Permission denied for pipeline which try to push commits into SCM using GitRepo resource

Writing a pipeline that can push commits into a bitbucket git repository using the GitRepo resource but I keep running into an issue with it. The user and integration have admin privileges on the repo and it was successfully able to create the webhook on the repo but for some reason is getting rejected when trying to push?

[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.

Upvotes: 2

Views: 135

Answers (1)

Deepika Banoth
Deepika Banoth

Reputation: 361

When you add a GitRepo type resource for a repository, for some security reasons we only create deployKey/accessKey on the scm for the repository with read permissions. If you want to commit anything from the pipeline, then you can achieve the same by doing following steps:

  1. Create SSH Key type integration with your keys (Please refer to this document: JFrog-Pipelines: SSH Key Integration for more info)
  2. Now, in your pipeline configure your git to use above keys. You can do this by adding the above integration as input to the step and use these environment variables: int_<integration-name>_publicKey and int_<integration-name>_privateKey in your step to configure git.
  3. Once configured, you can run any git command to commit or push as per your requirement.

Useful documents for reference:

  1. https://jfrog.com/help/r/jfrog-pipelines-documentation/ssh-key-integration
  2. https://jfrog.com/help/r/jfrog-pipelines-documentation/bash

Upvotes: 1

Related Questions