jaxbot / github-issues.vim

Github issue lookup in Vim
http://jaxbot.me/articles/github-issues-vim-plugin-5-7-2014
Other
405 stars 28 forks source link

Qs: using .ssh/config instead of github_token #154

Open amerlyq opened 8 years ago

amerlyq commented 8 years ago

All my repos have changed local credentials:

[remote "origin"]
    url = ghub:amerlyq/airy
    fetch = +refs/heads/*:refs/remotes/origin/*

And symmetrical part in ~/.ssh/config is

Host ghub
    HostName github.com
    User git
    IdentityFile ~/.ssh/git_rsa

And of course, I have running gpg to provide key passphrase caching through session. Therefore git_rsa already contains my identity and provides passwordless access.

Is it possible to use git_rsa instead of token? Is there really still need to provide github token anyway? What I don't understand about this? How can be changed code to conduct all api transactions through using git_rsa mechanics?

jaxbot commented 8 years ago

Hi there,

The GitHub token is for accessing the API. Is it possible to access the API using the git_rsa? If so, I can add support for that. API docs are here: https://developer.github.com/v3/

(Sorry, finals week and can't dig into it right this second)

amerlyq commented 8 years ago

I haven't found a way to do this, however it doesn't mean there isn't. Hoped, you had investigated deeper before.

Ok, therefore currently the only way to use plugin with raw token at work in more secure way is to encrypt token in gpg container and then read through system call. Something like this (lazy load for NeoBundle):

if neobundle#tap('github-issues.vim')
  let g:gissues_lazy_load = 1
  let g:gissues_async_omni = 1
  " let g:github_upstream_issues = 1
  fun! neobundle#hooks.on_source(bundle)
    "" USE:(encrypt): printf '<token>' | gpg -eo '<path>.gpg'
    let path = expand('~/.cache/airy/gpg/github-token.gpg')
    let cmd = 'gpg --use-agent --quiet --batch --decrypt '.shellescape(l:path)
    let g:github_access_token = system(l:cmd)
  endf
  call neobundle#untap()
endif

However, I somehow caused old bug #120 to resurrect :( (Edit) Maybe, it related to way how my local credentials defined? See uppermost message. Hope you look into issue after finals. Good luck!