How can I determine the API URL, project and repo slug for a ssh cloned repository

ccenvcvb July 11, 2020

I'd like to create a bash script that creates a pull request for the repo I'm in.

 

I can determine the ssh url using `git remote -v`

this give me ssh://git@gitserver:7999/myproject/myrepo.git

 

I need the https url, project & repo-slug for the pull request api call.

Is there a way to get this info from my repo

 

1 answer

1 accepted

0 votes
Answer accepted
ccenvcvb July 12, 2020

As far as I can tell there is no documented way to determine this.

I decided to add some properties to the git config

git config --global bitbucket.server.sshurl 'ssh://git@gitserver:7999'
git config --global bitbucket.server.apiurl 'https://gitserver/rest/api/1.0'
git config --local bitbucket.repo.project myproject
git config --local bitbucket.repo.slug myrepo

sshurl can probably be used to get project and slug from the remote url

ccenvcvb July 14, 2020

I'll accept my own answer as a work-around

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events