The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

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 Champions.
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.

TAGS
AUG Leaders

Atlassian Community Events