Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to commit and push into GIT repository during Pipeline build?

Deleted user April 28, 2018

Hi. We have written a maven plug-in so that whenever a feature branch is merged in develop branch it tags the commit automatically based on some information. We are using JGit to do that. For now, for testing, I am using my own username and password and since we only use our credentials to push the changes from local machine, I assumed that in Pipeline it works the same way but it appears Pipeline is using ssh. See this post please: https://stackoverflow.com/posts/comments/87140837?noredirect=1

 

How can we configure jgit to be able to push the changes automatically? By that I mean the details of ssh connection.

Thanks

1 answer

1 vote
DJM
Contributor
April 29, 2018

Hi,

 

are you looking for automatically ssh connection if that is the question i will suggest to create one account which is use for building which will be locally on that machine.

 

Thanks

DJM

Deleted user April 29, 2018

I am just trying to run a git command (git push).

 

My username is a valid and I even created ssh key. So in my project settings I generated a ssh key under Pipeline section and then added the key to my username, see this link:

https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html#SetupanSSHkey-ssh1

 

But when I use this path to point to the private key: "~/.ssh/id_rsa" I get file not found error. And when I change it to "~/.ssh/config" as it mentions in the SSH Key section under Pipeline, I get invalid privatekey error.

 What have I missed here?

How can I use Https to push my changes rather than ssh?

DJM
Contributor
April 30, 2018

Hi,

 

are you able to push using command line using ssh and using https

if yes then if you are doing build using this account it should then allow you to do this

Please try using command line first and see what error you are getting while push using https and using ssh

 

Thanks

DJM

Deleted user April 30, 2018

Hi

I put "cat" command to see the content of "~/.ssh/config" and realised that the private key path is actually inside this file not the privatekey itself. And that was:

/opt/atlassian/pipelines/agent/data/id_rsa 

 

That's why JGit was returning with "invalid private key" error. Once I set that, it worked.

Thanks for your time

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events