git-open icon indicating copy to clipboard operation
git-open copied to clipboard

Atlassian Stash support

Open kenahoo opened this issue 8 years ago • 9 comments

It's true that HTTP URLs contain /scm/, but that's for read-only access. If you're working with a repo that you can push to, it has an SSH URL that looks like this:

ssh://[email protected]:7999/foo/ken-homedir.git

where foo is a 3-or-4-letter key for the Project (a grouping of repositories).

In this case, perhaps recognizing the port number or the global format of the URL might be necessary. Open to a patch for that?

kenahoo avatar Nov 24 '15 16:11 kenahoo

While you're right that the current version of git-open does not seem to support Stash SSH URLs, you're slightly off on the usage of HTTP URLs.

You can have write access on HTTP URLs as well (which will use authentication in that case), just like you have write access using SSH.

You can enable and configure HTTP/SSH access in your Stash configuration.

This is probably not relevant to your question, but I wanted to clear that up anyway :smile:

nwinkler avatar Nov 25 '15 07:11 nwinkler

Oh - thanks for the clarification. Would still be great to get support for Stash (which is becoming BitBucket) SSH urls. =)

kenahoo avatar Nov 25 '15 13:11 kenahoo

+1

ixisio avatar Apr 15 '16 07:04 ixisio

was this fixed by https://github.com/paulirish/git-open/pull/36 ? anyone here confirm?

Please provide sample URLs if still broken and I'll add to backlog

davidosomething avatar Jul 11 '16 23:07 davidosomething

#36 just fixed it for the hosted bitbucket.org, not the self-hosted stash/bitbucket server for SSH. (http/https is supported already).

Using @kenahoo's example, the git remotes could look like: https://[email protected]/scm/foo/ken-homedir.git or: ssh://[email protected]:7999/foo/ken-homedir.git

And then you would open this URL in your browser: https://stash.server.local/projects/FOO/repos/ken-homedir/browse

I guess you would need to configure this similar to what is done with Gitlab.

JoakimLofgren avatar Feb 22 '17 17:02 JoakimLofgren

Is this still an issue?

derimagia avatar Feb 04 '18 17:02 derimagia

^ yes there are assumptions being made, such as repos always having scm in the url to distinguish them as stash, which is not valid

adding a check for port 7990 and 7999 (stash specific defaults for http and ssh) would be a good idea, but still does not catch proxied cases. It isn't possible to catch everything since stash URLs are under each individual organization's control

davidosomething avatar Feb 05 '18 15:02 davidosomething

How much of this can be solved with the git-open config?

https://github.com/paulirish/git-open/blob/4b1e8601a70d281a3e366f6824593e9e129b8660/git-open.1.md#gitlab-options

It says Gitlab options, but we should rename that since it works with any repo

derimagia avatar Mar 10 '18 17:03 derimagia

We should also rename the issue to "Bitbucket" instead of "Stash".

And yes, I agree, the config options for URL mapping should help with this. That should be the preferred option if the URL does not contain any hints about the type of server. I guess we could fire off a dummy request to the server and evaluate the response to figure out what server we're dealing with, but that sounds like overkill.

Maybe we could add an option that allows to set the kind of server for a given URL. So instead of setting up the URL mapping, we could configure that https://example.com/git/ is of type "Bitbucket" or something like that. Thoughts?

nwinkler avatar Mar 11 '18 10:03 nwinkler