Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert ssh:// link to a https:// one #36

Merged
merged 3 commits into from
Jul 8, 2016
Merged

Convert ssh:// link to a https:// one #36

merged 3 commits into from
Jul 8, 2016

Conversation

Naereen
Copy link
Contributor

@Naereen Naereen commented Jul 8, 2016

The script was failing on a Bitbucket repo using ssh instead of https. Now it should be fixed.

The script was failing on a Bitbucket repo using ssh instead of https. Now it should be fixed.
@davidosomething
Copy link
Contributor

i'd be more comfortable if this was in the actual bitbucket section since there is code that handles this for github and gitlab already:
https://github.com/paulirish/git-open/pull/36/files#diff-21e611831fd54f9104bb1bb2abf161eeL56
https://github.com/paulirish/git-open/pull/36/files#diff-21e611831fd54f9104bb1bb2abf161eeL83

@Naereen
Copy link
Contributor Author

Naereen commented Jul 8, 2016

Oh yes, sorry. I didn't even saw that this replacement of ssh:// to https:// was done for GitHub URLs already.
Sorry, it should be better now (I simply copy-pasted and changed the line that is used in the GitHub part).

@davidosomething
Copy link
Contributor

davidosomething commented Jul 8, 2016

the regex doesn't quite match since the bitbucket urls are in the form of

git@bitbucket.org:getvivekv/jquery-bootalert.git

I think all you needed to add was

giturl=${giturl#ssh:\/\/}

which strips out the ssh:// part

you only need that since the line above your addition ( https://github.com/paulirish/git-open/pull/36/files#diff-21e611831fd54f9104bb1bb2abf161eeR62 ) handles changing the git@bitbucket.org: to https already, but leaves the ssh:// if it was an ssh url

It works with either ``ssh://git@bitbucket.org/user/repo.git`` or ``ssh://git@bitbucket.org:user/repo.git``.
@Naereen
Copy link
Contributor Author

Naereen commented Jul 8, 2016

Well, my URL for Bitbucket are in the form of ssh://git@bitbucket.org/lbesson/bin.git, without : between the domain name and the user/repo.git part...
The latest commit works for both cases (with or without :).

@Naereen
Copy link
Contributor Author

Naereen commented Jul 8, 2016

Some of my repos are e.g., url = git@bitbucket.org:lbesson/web-sphinx.git, and some are url = ssh://git@bitbucket.org/lbesson/bin.git.

I think a few years ago the example URL given on an empty private repo (on Bitbucket) was using the not-recommended URL style without :, but now it's fixed.

Sorry for the inefficient work-flow, I hope the enhancement works now and can be merged.

@davidosomething davidosomething merged commit 55a5b96 into paulirish:master Jul 8, 2016
@davidosomething
Copy link
Contributor

lgtm! thanks

@Naereen
Copy link
Contributor Author

Naereen commented Jul 8, 2016

My pleasure.

Naereen added a commit to Naereen/bin that referenced this pull request Jan 9, 2021
Naereen added a commit to Naereen/bin that referenced this pull request Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants