【问题标题】:Creating a tag with the Bitbucket Server API fails使用 Bitbucket Server API 创建标签失败
【发布时间】:2019-11-27 19:18:32
【问题描述】:

我正在尝试使用 Bitbucket Server RST API 为特定提交(由哈希表示)创建新标签。请注意,我使用基本身份验证,但不要将其写入下面的示例。我得到的是 HTTP 500 响应。

curl -XPOST 'http://<server>/rest/api/latest/projects/p1/repos/r1/tags' -d '{

   "name": "my-new-tag", “哈希”:“0d2019c8e18f8c961cdb67cb27afb69b04f3a10b” }'

我也试过了:

curl -XPOST 'http://<server>/2.0/repositories/username/r1/refs/tags' -d '{

   "name": "my-new-tag", “哈希”:“0d2019c8e18f8c961cdb67cb27afb69b04f3a10b” }'

但在这种情况下,请求以 HTTP 404 结束,我认为这是因为这不是 Bitbucket 服务器 URL。

【问题讨论】:

    标签: api bitbucket


    【解决方案1】:

    你可以试试这个方法:

    curl -X POST -k -H 'Content-Type: application/json' -s -u <Your Account>:<Your password> -i 'https://api.bitbucket.org/2.0/repositories/username/r1/refs/tags' --data '{
           "name": "my-new-tag",
           "target":{
               "hash": "0d2019c8e18f8c961cdb67cb27afb69b04f3a10b"
           }
        }'
    

    curl -X POST -k -H 'Content-Type: application/json' Authorization: Basic <<Authentication String>>' -i 'https://api.bitbucket.org/2.0/repositories/username/r1/refs/tags' --data '{
           "name": "my-new-tag",
           "target":{
               "hash": "0d2019c8e18f8c961cdb67cb27afb69b04f3a10b"
           }
        }'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-11
      • 1970-01-01
      • 2017-12-25
      • 2016-11-11
      • 2023-02-03
      • 2011-04-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多