Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

is it possible to create remote stash repository from local bash file.

io
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 11, 2014
 

2 answers

1 accepted

2 votes
Answer accepted
Config Manager
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 11, 2014

Yes - use curl with the RESTAPI - this works for me:

 

#!/bin/bash

projectName=$1

repoName=$2


stashUser="username:password"

stashIP="server:7990"



api="http://${stashIP}/projects/${projectName}/repos"



json="{\"name\": \"${repoName}\"}"

 

curl -f -u $stashUser -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' --stderr - $api -d "$json"

 

 It returns a json block giving details of the created repo

Or else use the exceedingly good Stash Command Line Interface - a paid-for Add-on - which makes it much easier. It would be something like

stash.sh --action createRepository --project $projectName --repository $repoName

 

Regards,

John

0 votes
io
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 12, 2014

Thank you, it worked.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events