pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
MIT License
2.33k stars 125 forks source link

Utils `get_remote` doesn't work with `.ssh/config` aliases #295

Closed dharrigan closed 2 years ago

dharrigan commented 2 years ago

Issue Description

Type: bug report

Describe what happened (or what feature you want)

Using Octo issue list, I'm receiving this error Post "https://github/api/graphql": x509: certificate.....

Describe what you expected to happen

I'm able to retrieve the issue list

How to reproduce it (as minimally and precisely as possible)

  1. Create a `~/.ssh/config' file
  2. Add the following
    host github
    hostname github.com
    user git
  3. Clone a repo git clone ssh://github/foo/bar
  4. Try to do Octo issue list

Tell us your environment

Linux daffy 5.17.9-arch1-1 NVIM v0.7.0

Latest Octo

Anything else we need to know?

I think the issue here is from https://github.com/pwntester/octo.nvim/blob/5517cbdf302be2abc4ac43e5b8b2a812d0222bbb/lua/octo/utils.lua#L169 it's expecting a particular format for the git repo. Then at line https://github.com/pwntester/octo.nvim/blob/5517cbdf302be2abc4ac43e5b8b2a812d0222bbb/lua/octo/utils.lua#L184 it's spliting it, assuming there is a @ in the host and that the hostname also is in two parts, i.e., github.com not github.

Changing the .git/confg to read git@github.com results in successful retrieval of issues.

pwntester commented 2 years ago

hhmm, seems like the only solution would be to parse the ssh config which I dont think should be done by Octo. Can you think of any other solution or workaround?

pwntester commented 2 years ago

This should be fixed now. But you need to define the aliases in your setup config:

ssh_aliases = {["github"] = "github.com"}

artistic-nucleus commented 1 year ago

Hey, adding ssh_aliases is still not working for me..Can you help?