【问题标题】:How to use Stash REST API with SSH authentication?如何将 Stash REST API 与 SSH 身份验证一起使用?
【发布时间】:2015-09-10 16:45:12
【问题描述】:

我正在尝试使用 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 身份验证的正确方法是什么?

【问题讨论】:

  • REST 是一种使用 http 协议的技术。它甚至如何通过原始 ssh 连接工作?

标签: curl ssh bitbucket-server


【解决方案1】:

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

您可以使用 Basic auth 或 OAuth 访问 REST。

【讨论】:

    【解决方案2】:

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

    machine example.com
    login daniel
    password qwerty
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-28
      • 2021-10-09
      • 2018-09-28
      • 1970-01-01
      • 2018-07-04
      相关资源
      最近更新 更多