在文档中,我甚至找不到任何相关的内容。
https://bitbucket.org/username/oldname/overview
'r'
,然后输入'a'
进行管理,而不是使用1和2。Name
字段中更改名称。Save repository details.
https://username@bitbucket.org/username/oldname.git
现在,repo的URL / Path将为https://username@bitbucket.org/username/newname.git
您可以通过返回概述页面并将鼠标悬停在大蓝色HTTPS按钮上来检查这一点。您的浏览器底部将显示它现在指向https://username@bitbucket.org/username/newname.git
如果您正在使用SourceTree,则可以通过在SourceTree中突出显示本地repo,然后执行以下操作来更新远程URL:
Repository
Repository Settings...
origin https://username@bitbucket.org/username/oldname.git
Edit
URL / Path
字段。将'oldname.git'更改为'newname.git',其余内容保持不变。因此,完整路径应为https://username@bitbucket.org/username/newname.git
OK
PUT https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug} --data "{\"name\": \"${new_name}\"}"
使用PUT方法可以重命名存储库。
根据https://confluence.atlassian.com/display/BITBUCKET/repository+Resource+1.0:
PUT https://api.bitbucket.org/1.0/repositories/{accountname}/{repo_slug} --data "name=new name"
这允许更新存储库的可见名称。
在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
万一有人因为旧版本的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命令:
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