如何通过 SSH 身份验证使用 Stash REST API?

How to use Stash REST API with SSH authentication?

我正在尝试使用 Stash REST API。我们使用 SSH 进行身份验证。

curl -X GET -u me@example.com: --key ~/.ssh/id_rsa \
  'https://stash.corp.netflix.com/rest/api/1.0/projects/MY_PROJ/repos/MY_REPO/commits'

返回:

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

curl -X GET -u me@example.com: --key ~/.ssh/id_rsa \
  'ssh://stash.corp.netflix.com/rest/api/1.0/projects/MY_PROJ/repos/MY_REPO/commits'

错误为:

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

使用 Stash 的 REST API 和 SSH 身份验证的正确方法是什么?

根据 Kenster 的评论,访问 REST API 的唯一方法是通过 HTTP(S)。 SSH 仅提供对 git 托管层的访问。

您可以使用基本身份验证或OAuth访问 REST。

这适用于使用 ff 格式的 ~/.netrc 文件:

machine example.com
login daniel
password qwerty

参考:https://ec.haxx.se/usingcurl/usingcurl-netrc