Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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

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

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,441 views 4 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you