Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

stash repository path on linux

MASAHIRO_KOREYASU July 16, 2012

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
Answer accepted
jhinch (Atlassian)
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 7, 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.

Sameer Jaffer April 17, 2013

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
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 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

MASAHIRO_KOREYASU July 17, 2012

thanks for response :)

Tobias Hochguertel September 3, 2013

Also Thank your for this information!

1 vote
Michael Heemskerk
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 14, 2013

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"}
}

Håkon Løvdal June 20, 2013

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.

Kota Sreenivasa Shravana Kumar June 26, 2014

The following did not work for me. Any clue ?

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

Michael Heemskerk
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 26, 2014

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

1 vote
Colin Goudie
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.
July 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

MASAHIRO_KOREYASU July 16, 2012

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"}}

0 votes
Ken Parmalee March 13, 2013

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
TAGS
AUG Leaders

Atlassian Community Events