stash repository path on linux

How can I know the repository path on linux?

I choiced "/var/atlassian/stash/data/repositories" as repository root path.
Then I created some projects and repositories.
Now I want to edit hook script, but I cannot know the target repository's path.
(Some numbering directory(1, 2, 3... not project and repository name) exist in repositries directory)

environment:

  • scientific linux 6.0
  • stash 1.1.1 with hsqldb

5 answers

1 accepted

1 vote
Jason Hinch Atlassian Team Aug 07, 2012

To help mitigate this issue we've created a plugin for Stash, the Repository System Info Plugin. It allows system administrators to view the location on disk of the repository through the Stash UI.

EDIT: As of 2.7 you can view this information on the repository settings page.

Is there a way to access the location via calling the plugin in Hook code? trying to get the repository directory from the post recieve hook to modify a file in the Hook code.

Cheers,

Sameer Jaffer

2 votes
Seb Ruiz Atlassian Team Jul 16, 2012

Hi,

There is currently no way in Stash to determine where a repository lives on disk without peeking into the database and looking at the repository id.

There is an open feature request to make repositories on disk easier to find.

https://jira.atlassian.com/browse/STASH-2552

Thanks,

Seb

thanks for response :)

Also Thank your for this information!

1 vote
Colin Goudie Community Champion Jul 16, 2012

I would say the numbers relate to the repository id internally in stash.

You might have to use the stash REST API to find the repository id out though

Which api do I need to use in https://developer.atlassian.com/static/rest/stash/1.1.2.html ?

I tried to use "http://example.com/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug} ", but I couldn't get the repository id.
-----
curl -u xxx:xxx -X GET -H "Content-Type: application/json" http://localhost:7990/stash/rest/api/1.0/projects/TEST/repos/repo
{"slug":"repo","name":"REPO","type":"GIT","state":"AVAILABLE","statusMessage":"Available","cloneUrl":"https://xxx@xxx/stash/scm/TEST/repo.git","project":null,"link":{"url":"/projects/TEST/repos/repo/browse","rel":"self"}}

1 vote

Since Stash 2.1, the repository id is also returned from the REST API.

curl -u admin:admin -X GET http://localhost:7990/stash/rest/api/latest/projects/PROJECT_1/repos/rep_1

Will now return:

{
  "slug":"rep_1",
  "id":1,
  "name":"rep_1",
  "scmId":"git",
  "state":"AVAILABLE",
  "statusMessage":"Available",
  "project":{
    "key":"PROJECT_1",
    "id":1,
    "name":"Project 1",
    "description":"Default configuration project #1",
    "isPersonal":false,
    "link":{"url":"/projects/PROJECT_1","rel":"self"}
}

The above url did not work for me, but http://localhost:7990/stash/rest/api/latest/projects/PROJECT_1/repos/rep_1 gave output aproximately as above.

Looks like the URL I provided had an extra /repo/ in the path that shouldn't have been there. I've fixed my comment with the correct URL.

Try

curl -u username:password -X GET http://localhost:7990/stash/rest/api/latest/projects/U3SI/repos/dom-2010

Compare the directories in refs/heads to what you see in Stash GUI. If needed, dig a little deeper and compare the commit hash to last commit in Stash GUI.

Example: given a path <stash_home>/data/repositories/<some #>/refs/heads,

run ls to obtain a dir listing

compare output to Stash GUI Repository by clicking Repositories at top, by default it shows Files. Then click the directory drop down button directly underneath to show all dirs.

If your projects use a similar directory layout --

run less against one of the files listed using ls earlier.

compare hash against Stash GUI by clicking Commits (next to Files.) Usually the short code listed is fine, but you can click on it to obtain the full hash.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

2,048 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you