2

Earlier I had asked a question about how to raise a pull request from command line and with help I came up with this code to get it done:

curl -k -X POST -H "Content-Type: application/json" --user username:password -d '{"title":"test","description":"test","fromRef":{"id":"branchone","repository":{"slug":"TrialRepo","name":null,"project":{"key":"~SS48647"}}},"toRef":{"id":"master","repository":{"slug":"TrialRepo","name":null,"project":{"key":"~SS48647"}}}}' https://url/bitbucket/rest/api/1.0/projects/~SS48647/repos/trialrepo/pull-requests

The thing is this code will run in production environment and username and password can't be plain-texted.

I was thinking if it'd be possible to use SSH Keys for user-authentication. I will generate keys on a unix machine and I will add the public key to Bitbucket. Please add your views on how to get this done. Also, if there's a better way to avoid plain-texted user-authentication it'd be great. Thanks

2
  • I also need to use a Bitbucket curl with ssh keys. Have you figured it out @shal8mani ? Commented Jul 16, 2019 at 22:11
  • Apologies for later reply. But couldn't find any solution yet. Commented Dec 7, 2019 at 18:42

1 Answer 1

1

I guess it is about a Bitbucket Server instance here, right?

According this documentation there is just Basic Authentication, OAuth or Session Authentication. https://developer.atlassian.com/server/bitbucket/how-tos/command-line-rest/#authentication

One addition to Basic Authentication are the Personal Access Tokens, which can be generated per user and can be used as a password too: https://confluence.atlassian.com/bitbucketserver0516/personal-access-tokens-966061199.html#Personalaccesstokens-usingpersonalaccesstokens

But, I guess for you the most proper solution would be to create an Application Link and use OAuth.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.