How to give a group write access to a Bitbucket repository via shell command line
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I've created a Bitbucket repository using a Jenkinsfile, with the following code (with private data replaced with {}):
sh "curl -X POST -H "Authorization: Basic {KEY}="
"https://api.bitbucket.org/2.0/repositories/{project}/{repository_name}"
-H "Content-Type: application/json"
-d '{"has_wiki": true, "is_private": true, "project": {"key": "{key}"}}'"
This creates a repository with default access rights.
I need to then give a Group Write access to this repository.
I've scoured the internet and I can't find any up to date documentation or examples of how to do this. How do I do this using a shell command?
git shell bitbucket jenkins-pipeline usergroups
add a comment |
I've created a Bitbucket repository using a Jenkinsfile, with the following code (with private data replaced with {}):
sh "curl -X POST -H "Authorization: Basic {KEY}="
"https://api.bitbucket.org/2.0/repositories/{project}/{repository_name}"
-H "Content-Type: application/json"
-d '{"has_wiki": true, "is_private": true, "project": {"key": "{key}"}}'"
This creates a repository with default access rights.
I need to then give a Group Write access to this repository.
I've scoured the internet and I can't find any up to date documentation or examples of how to do this. How do I do this using a shell command?
git shell bitbucket jenkins-pipeline usergroups
add a comment |
I've created a Bitbucket repository using a Jenkinsfile, with the following code (with private data replaced with {}):
sh "curl -X POST -H "Authorization: Basic {KEY}="
"https://api.bitbucket.org/2.0/repositories/{project}/{repository_name}"
-H "Content-Type: application/json"
-d '{"has_wiki": true, "is_private": true, "project": {"key": "{key}"}}'"
This creates a repository with default access rights.
I need to then give a Group Write access to this repository.
I've scoured the internet and I can't find any up to date documentation or examples of how to do this. How do I do this using a shell command?
git shell bitbucket jenkins-pipeline usergroups
I've created a Bitbucket repository using a Jenkinsfile, with the following code (with private data replaced with {}):
sh "curl -X POST -H "Authorization: Basic {KEY}="
"https://api.bitbucket.org/2.0/repositories/{project}/{repository_name}"
-H "Content-Type: application/json"
-d '{"has_wiki": true, "is_private": true, "project": {"key": "{key}"}}'"
This creates a repository with default access rights.
I need to then give a Group Write access to this repository.
I've scoured the internet and I can't find any up to date documentation or examples of how to do this. How do I do this using a shell command?
git shell bitbucket jenkins-pipeline usergroups
git shell bitbucket jenkins-pipeline usergroups
edited Nov 16 '18 at 14:32
CodeWizard
55.6k1270100
55.6k1270100
asked Nov 16 '18 at 13:59
JamesJames
2881313
2881313
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
What you are looking for is: "permission":"write"
Here are the API calls to update the group permissions:
"permission":"write"
The full API call:
curl --request PUT --user username:password
<repo url>
--header "Content-Type: application/json"
--header "Accept: application/json"
--data '{"name":"developers","permission":"write","auto_add":true}'
What format should the <repo url> be? I seem to get a no such file or directory error no matter what I put. Also, further to this, how would I do this without having to put a raw username and password into the request? Is a BASIC authorisation token possible to use instead?
– James
Nov 19 '18 at 9:18
1
Your bitbucket URL for the given repository
– CodeWizard
Nov 19 '18 at 9:51
I managed to get the shell command to complete, however it doesn't seem to have changed anything on the repository. I'll have a look around to see if I can find out why. Thank you for your help so far!
– James
Nov 19 '18 at 9:59
The documentation I've found online suggests the following format for the URL:api.bitbucket.org/1.0/groups/username@example.com/designers. Is this the format you are expecting? This to me looks like the format for updating a group privilege within a group, not for adding a group to a repository. The raw URL of my repository (bitbucket.org/<project>/<repo-name>) command works but does not result in the group being added to the repo.
– James
Nov 19 '18 at 10:28
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339305%2fhow-to-give-a-group-write-access-to-a-bitbucket-repository-via-shell-command-lin%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
What you are looking for is: "permission":"write"
Here are the API calls to update the group permissions:
"permission":"write"
The full API call:
curl --request PUT --user username:password
<repo url>
--header "Content-Type: application/json"
--header "Accept: application/json"
--data '{"name":"developers","permission":"write","auto_add":true}'
What format should the <repo url> be? I seem to get a no such file or directory error no matter what I put. Also, further to this, how would I do this without having to put a raw username and password into the request? Is a BASIC authorisation token possible to use instead?
– James
Nov 19 '18 at 9:18
1
Your bitbucket URL for the given repository
– CodeWizard
Nov 19 '18 at 9:51
I managed to get the shell command to complete, however it doesn't seem to have changed anything on the repository. I'll have a look around to see if I can find out why. Thank you for your help so far!
– James
Nov 19 '18 at 9:59
The documentation I've found online suggests the following format for the URL:api.bitbucket.org/1.0/groups/username@example.com/designers. Is this the format you are expecting? This to me looks like the format for updating a group privilege within a group, not for adding a group to a repository. The raw URL of my repository (bitbucket.org/<project>/<repo-name>) command works but does not result in the group being added to the repo.
– James
Nov 19 '18 at 10:28
add a comment |
What you are looking for is: "permission":"write"
Here are the API calls to update the group permissions:
"permission":"write"
The full API call:
curl --request PUT --user username:password
<repo url>
--header "Content-Type: application/json"
--header "Accept: application/json"
--data '{"name":"developers","permission":"write","auto_add":true}'
What format should the <repo url> be? I seem to get a no such file or directory error no matter what I put. Also, further to this, how would I do this without having to put a raw username and password into the request? Is a BASIC authorisation token possible to use instead?
– James
Nov 19 '18 at 9:18
1
Your bitbucket URL for the given repository
– CodeWizard
Nov 19 '18 at 9:51
I managed to get the shell command to complete, however it doesn't seem to have changed anything on the repository. I'll have a look around to see if I can find out why. Thank you for your help so far!
– James
Nov 19 '18 at 9:59
The documentation I've found online suggests the following format for the URL:api.bitbucket.org/1.0/groups/username@example.com/designers. Is this the format you are expecting? This to me looks like the format for updating a group privilege within a group, not for adding a group to a repository. The raw URL of my repository (bitbucket.org/<project>/<repo-name>) command works but does not result in the group being added to the repo.
– James
Nov 19 '18 at 10:28
add a comment |
What you are looking for is: "permission":"write"
Here are the API calls to update the group permissions:
"permission":"write"
The full API call:
curl --request PUT --user username:password
<repo url>
--header "Content-Type: application/json"
--header "Accept: application/json"
--data '{"name":"developers","permission":"write","auto_add":true}'
What you are looking for is: "permission":"write"
Here are the API calls to update the group permissions:
"permission":"write"
The full API call:
curl --request PUT --user username:password
<repo url>
--header "Content-Type: application/json"
--header "Accept: application/json"
--data '{"name":"developers","permission":"write","auto_add":true}'
answered Nov 16 '18 at 15:49
CodeWizardCodeWizard
55.6k1270100
55.6k1270100
What format should the <repo url> be? I seem to get a no such file or directory error no matter what I put. Also, further to this, how would I do this without having to put a raw username and password into the request? Is a BASIC authorisation token possible to use instead?
– James
Nov 19 '18 at 9:18
1
Your bitbucket URL for the given repository
– CodeWizard
Nov 19 '18 at 9:51
I managed to get the shell command to complete, however it doesn't seem to have changed anything on the repository. I'll have a look around to see if I can find out why. Thank you for your help so far!
– James
Nov 19 '18 at 9:59
The documentation I've found online suggests the following format for the URL:api.bitbucket.org/1.0/groups/username@example.com/designers. Is this the format you are expecting? This to me looks like the format for updating a group privilege within a group, not for adding a group to a repository. The raw URL of my repository (bitbucket.org/<project>/<repo-name>) command works but does not result in the group being added to the repo.
– James
Nov 19 '18 at 10:28
add a comment |
What format should the <repo url> be? I seem to get a no such file or directory error no matter what I put. Also, further to this, how would I do this without having to put a raw username and password into the request? Is a BASIC authorisation token possible to use instead?
– James
Nov 19 '18 at 9:18
1
Your bitbucket URL for the given repository
– CodeWizard
Nov 19 '18 at 9:51
I managed to get the shell command to complete, however it doesn't seem to have changed anything on the repository. I'll have a look around to see if I can find out why. Thank you for your help so far!
– James
Nov 19 '18 at 9:59
The documentation I've found online suggests the following format for the URL:api.bitbucket.org/1.0/groups/username@example.com/designers. Is this the format you are expecting? This to me looks like the format for updating a group privilege within a group, not for adding a group to a repository. The raw URL of my repository (bitbucket.org/<project>/<repo-name>) command works but does not result in the group being added to the repo.
– James
Nov 19 '18 at 10:28
What format should the <repo url> be? I seem to get a no such file or directory error no matter what I put. Also, further to this, how would I do this without having to put a raw username and password into the request? Is a BASIC authorisation token possible to use instead?
– James
Nov 19 '18 at 9:18
What format should the <repo url> be? I seem to get a no such file or directory error no matter what I put. Also, further to this, how would I do this without having to put a raw username and password into the request? Is a BASIC authorisation token possible to use instead?
– James
Nov 19 '18 at 9:18
1
1
Your bitbucket URL for the given repository
– CodeWizard
Nov 19 '18 at 9:51
Your bitbucket URL for the given repository
– CodeWizard
Nov 19 '18 at 9:51
I managed to get the shell command to complete, however it doesn't seem to have changed anything on the repository. I'll have a look around to see if I can find out why. Thank you for your help so far!
– James
Nov 19 '18 at 9:59
I managed to get the shell command to complete, however it doesn't seem to have changed anything on the repository. I'll have a look around to see if I can find out why. Thank you for your help so far!
– James
Nov 19 '18 at 9:59
The documentation I've found online suggests the following format for the URL:api.bitbucket.org/1.0/groups/username@example.com/designers. Is this the format you are expecting? This to me looks like the format for updating a group privilege within a group, not for adding a group to a repository. The raw URL of my repository (bitbucket.org/<project>/<repo-name>) command works but does not result in the group being added to the repo.
– James
Nov 19 '18 at 10:28
The documentation I've found online suggests the following format for the URL:api.bitbucket.org/1.0/groups/username@example.com/designers. Is this the format you are expecting? This to me looks like the format for updating a group privilege within a group, not for adding a group to a repository. The raw URL of my repository (bitbucket.org/<project>/<repo-name>) command works but does not result in the group being added to the repo.
– James
Nov 19 '18 at 10:28
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53339305%2fhow-to-give-a-group-write-access-to-a-bitbucket-repository-via-shell-command-lin%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown