2

有人知道如何通过 cURL 从 bitbucket 中删除存储库吗?

目前我已经制作了通过 curl 在 bitbucket 上创建远程存储库的脚本

#!/bin/bash
while read line
do
curl --user user:password https://api.bitbucket.org/1.0/repositories/ --data name=$line --data is_private=true --data owner=OWNER
done<repo_list.txt

但现在我无法通过 curl 从 bitbucket 中删除该存储库

我正在使用

curl -X DELETE --user user:password https://api.bitbucket.org/1.0/repositories/ --data name=$line --data is_private=true --data owner=OWNER

并有错误 {"error": {"message": "'username'", "detail": " File \"/opt/python/domains/bitbucket.org/current/bitbucket/local/env/lib/python2. 7/site-packages/piston/resource.py\",第 208 行,通话中\n}

https://bitbucket.org/zhemao/bitbucket-cli仅从用户帐户中删除存储库,但没有选项删除我所属的其他所有者拥有的存储库。

有任何想法吗 ?

4

1 回答 1

6

删除repo 的语法与创建repo的语法不同。

去创造:

POST https://bitbucket.org/api/1.0/repositories --data "name=mynewrepo"

删除:

DELETE https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug}

此外,API v1.0 方法已被弃用,因此您应该使用v2.0 方法

去创造:

POST https://api.bitbucket.org/2.0/repositories/{owner}/{repo_slug}

删除:

DELETE https://api.bitbucket.org/2.0/repositories/{owner}/{repo_slug}
于 2014-03-13T21:57:29.270 回答