paulirish / git-open

Type `git open` to open the GitHub page or website for a repository in your browser.
MIT License
3.28k stars 246 forks source link

Atlassian Stash support #33

Open kenahoo opened 8 years ago

kenahoo commented 8 years ago

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://git@stash.server.local: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?

nwinkler commented 8 years ago

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:

kenahoo commented 8 years ago

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

ixisio commented 8 years ago

+1

davidosomething commented 7 years ago

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

JoakimLofgren commented 7 years ago

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://username@stash.server.local/scm/foo/ken-homedir.git or: ssh://git@stash.server.local: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.

derimagia commented 6 years ago

Is this still an issue?

davidosomething commented 6 years ago

^ 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

derimagia commented 6 years ago

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

nwinkler commented 6 years ago

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?