paulirish / git-open

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

Opens ssh.github.com since upgrading #135

Closed goodguyry closed 5 years ago

goodguyry commented 5 years ago

Since upgrading (from which version I'm not sure), git open is opening URLs at a nonexistent ssh subdomain. The repos were all cloned with SSH, in case that has something to do with it. This was never an issue before...

Thanks. Let me know if you need additional info.


If an incorrect URL is opened, please provide the following so we can write a test:

Example clone url:

https://github.com/goodguyry/postcss-tidy-columns

Example branch name:

master

Expected web URL:

https://github.com/goodguyry/postcss-tidy-columns

Actual web URL:

https://ssh.github.com/goodguyry/postcss-tidy-columns

derimagia commented 5 years ago

Hmm I'm thinking it's related to https://github.com/paulirish/git-open/pull/109 (cc @4U6U57)

Do you have anything in your ~/.ssh/config file related to aliases for github like this?

goodguyry commented 5 years ago

Yep, that's it! When I comment out those lines in my SSH config git open opens the expected URL.

derimagia commented 5 years ago

What's your reasoning for having an alias from github.com -> ssh.github.com?

goodguyry commented 5 years ago

I'm not certain. I was surprised to see it there. Best I can tell it came from https://help.github.com/articles/using-ssh-over-the-https-port/, but I haven't noticed any adverse effects since disabling it.

andreafalzetti commented 5 years ago

Any update on this?

goodguyry commented 5 years ago

No update. The script is working as expected since removing the GitHub lines from my ~/.ssh/config, though I'm not certain that's a viable solution.

andreafalzetti commented 5 years ago

Cool, working now. Thanks!

4U6U57 commented 4 years ago

I was cleaning up my GitHub notifications and spotted this old thread. Just wanted to clarify the issue and possible solutions.

GitHub supports SSH over HTTPS by mapping github.com to ssh.github.com, as mentioned here:

I'm not certain. I was surprised to see it there. Best I can tell it came from https://help.github.com/articles/using-ssh-over-the-https-port/, but I haven't noticed any adverse effects since disabling it.

The problem is that git open expects any ssh domain to map to a corresponding repo page over http, which is true for git@github.com but not true for git@ssh.github.com (ssh.github.com gives ERR_SSL_PROTOCOL_ERROR, it doesn't serve webpages). So this is a caveat of GitHub's design/usage of their ssh.github.com subdomain.

To fix git open's treatment of this subdomain, you can either:

  1. Not use SSH over HTTPS (remove the corresponding lines in your ~/.ssh/config, as previously recommended)
  2. Explicitly map ssh.github.com back to github.com within git open's config, by running:
git config --global open.https://ssh.github.com.domain github.com