After completing the interactive `gh auth login` flow, the `hosts.yml`
config file will have been populated with both `oauth_token` and `user`
properties for the GitHub host. However, after `auth login --with-token`
only the `oauth_token` is persisted but no username.
This fixes `auth git-credential` behavior so it allows authentication
even if the `user` property is missing. It's entirely optional to send a
proper username for git authentication, since GitHub seems to ignore the
actual value sent and just focuses on the token itself.
* Allow `gh auth git-credential` to authenticate GitHub Gist requests
When there are stored credentials for `example.com`, allow using them to
authenticate requests to `gist.example.com` as well.
* Fix writing out of credential config
* remove unneccessary function
* actually delete
Co-authored-by: nate smith <vilmibm@github.com>
When a token such as GH_TOKEN is set through environment variables and
`~/.config/gh/hosts.yml` is non-existent, the `auth git-credential get`
command used to fail due to missing username.
Since GitHub username isn't at all required for token authentication,
use the `x-access-token` faux username instead of trying to obtain one
from a config file.