How to allow public access to a repository via the REST API in Bitbucket Server

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

要約

In some cases, a Bitbucket Administrator will be required to update the public access of repositories in bulk, and updating via the UI can become tedious and time-consuming.
This task can easily be accomplished by running a cURL command on a REST endpoint.

環境

Bitbucket Server or Data Center

ソリューション

Note for personal repositories

The <project-key> will go by the pattern ~username

Example: John Doe (username: jdoe) created a repository named MyRepository.

  • The project-key will be ~jdoe
  • The reposlug will be myrepository

Allow public access to a repository

curl -u <username> --location --request PUT 'https://host:port/rest/api/latest/projects/<project-key>/repos/<reposlug>' \
	--header 'Content-Type: application/json' \
	--data-raw '{"public": true}'

Deny public access to a repository

curl -u <username> --location --request PUT 'https://host:port/rest/api/latest/projects/<project-key>/repos/<reposlug>' \
	--header 'Content-Type: application/json' \
	--data-raw '{"public": false}'

リファレンス

Further information on https://docs.atlassian.com/bitbucket-server/rest/<bitbucket-server-version>/bitbucket-rest.html


最終更新日 2022 年 9 月 26 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.