Noel Yap
Noel Yap

Reputation: 19768

How to use Stash REST API with SSH authentication?

I'm trying to use the Stash REST API. We use SSH to authenticate.

curl -X GET -u [email protected]: --key ~/.ssh/id_rsa \
  'https://stash.corp.netflix.com/rest/api/1.0/projects/MY_PROJ/repos/MY_REPO/commits'

is returning:

{"errors":[{"context":null,"message":"Authentication failed. Please check your credentials and try again.","exceptionName":null}]}

and

curl -X GET -u [email protected]: --key ~/.ssh/id_rsa \
  'ssh://stash.corp.netflix.com/rest/api/1.0/projects/MY_PROJ/repos/MY_REPO/commits'

is erroring with:

curl: (1) Protocol ssh not supported or disabled in libcurl

What is the right incantation to use Stash's REST API with SSH authentication?

Upvotes: 0

Views: 4215

Answers (2)

japzio
japzio

Reputation: 19

This work with using ~/.netrc file with the ff format :

machine example.com
login daniel
password qwerty

refer to : https://ec.haxx.se/usingcurl/usingcurl-netrc

Upvotes: 0

Rog
Rog

Reputation: 4085

Per Kenster's comment, the only way to access the REST API is via HTTP(S). SSH only provides access to the git hosting layer.

You can use Basic auth or OAuth to access REST.

Upvotes: 3

Related Questions