有没有办法使用Bitbucket上的API重命名存储库
是否可以使用其REST API重命名Bitbucket上的现有存储库? 我阅读了Bitbucket API的全部文档,但我找不到任何与之相关的内容。 我在问也许我错过了什么。谢谢大家! 对于API的1.0版: 根据: 这允许更新存储库的可见名称 对于API的第2版: 据有没有办法使用Bitbucket上的API重命名存储库,bitbucket,bitbucket-api,Bitbucket,Bitbucket Api,是否可以使用其REST API重命名Bitbucket上的现有存储库? 我阅读了Bitbucket API的全部文档,但我找不到任何与之相关的内容。 我在问也许我错过了什么。谢谢大家! 对于API的1.0版: 根据: 这允许更新存储库的可见名称 对于API的第2版: 据 使用PUT方法可以重命名存储库。在unix shell中,可以使用cURL curl https://api.bitbucket.org/1.0/repositories/{accountname}/{old_repo_name
使用PUT方法可以重命名存储库。在unix shell中,可以使用cURL
curl https://api.bitbucket.org/1.0/repositories/{accountname}/{old_repo_name} --data "name=new_repo_name" -X PUT
用户是否可以在私有存储库中进行身份验证,但仍然只有管理员能够执行:
curl https://USER:PASS@api.bitbucket.org/1.0/repositories/{accountname}/{old_repo_name} --data "name=new_repo_name" -X PUT
根据最新的API,以下是正确的curl命令:
curl -X PUT --user username:password https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug} --data "name=newRepoName"
请注意,repo_slug是小写的存储库名称。如果你不把它全部放在小写字母里,你会得到不那么富有表现力的答案“找不到”
如果不确定存储库slug是什么,请执行以下命令,该命令显示用户信息,包括当前存储库,并查找字段“slug”
使用Bitbucket网站,您可以按如下方式重命名回购:
https://bitbucket.org/username/oldname/overview
'r'
,然后键入'a'
进行管理李>
名称
字段中更改名称保存存储库详细信息。
https://username@然而,现在回购协议的URL/路径将是https://username@bitbucket.org/username/newname.git
您可以通过返回概览页面并将鼠标悬停在蓝色的HTTPS按钮上来检查这一点。浏览器底部将显示它现在指向https://username@bitbucket.org/username/newname.git
如果您使用的是SourceTree,则可以通过在SourceTree中突出显示本地repo,然后
单击Repository
单击存储库设置…
原点https://username@bitbucket.org/username/oldname.git
URL/Path
字段。将“oldname.git”更改为“newname.git”,其余内容保持不变。因此,完整路径应为https://username@bitbucket.org/username/newname.git
OK
如果有人在寻找bitbucket API旧版本(在我的例子中是5.14.0)的解决方案时遇到这种情况,那么说这个版本缺少文档是非常礼貌的
curl --location --request PUT 'https://git.local.install/rest/api/1.0/projects/aa/repos/my-repo' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic .....' \
--data-raw '{"name":"my-new-name"}'
非常感谢。我不知道我是怎么漏掉的。我们中最优秀的:)回答了问题,为什么这不是投票率最高的答案?如果你找不到设置按钮,当前它“隐藏”在左下角。这个问题是关于API的,所以尽管这个答案包含有用的信息,但它没有回答问题
curl -X PUT --user username:password https://bitbucket.org/api/1.0/repositories/{accountname}/{repo_slug} --data "name=newRepoName"
curl --user username:password https://bitbucket.org/api/1.0/user
curl --location --request PUT 'https://git.local.install/rest/api/1.0/projects/aa/repos/my-repo' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic .....' \
--data-raw '{"name":"my-new-name"}'