-
Notifications
You must be signed in to change notification settings - Fork 0
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
Issue accessing GH host with customized hostname #12
Comments
Oh, looks like if I pass |
This is something I would like to investigate. Were you running the script in your repo's directory @yermulnik? |
Yep. Let me show: > git rev-parse --show-cdup
../
> gh role
2023/04/27 23:00:49 unable to determine current repository, none of the git remotes configured for this repository point to a known GitHub host
> cd .. && git rev-parse --show-cdup && gh role
2023/04/27 23:01:15 unable to determine current repository, none of the git remotes configured for this repository point to a known GitHub host
> cd .. && gh role
2023/04/27 23:01:32 failed to run git: fatal: not a git repository (or any of the parent directories): .git
. error: exit status 128
> gh role -r my_org/my_repo
admin Please do let me know if I can do anything to help investigating this. |
@yermulnik, with the new release I've updated the APIs. The repo check should be more robust. Can you give it a try again? I don't currently have a simple way to test against custom host names. If this doesn't resolve the problem, I'll create a custom host to test against. |
No luck 😢 > gh extension upgrade role
[role]: upgraded from v2.1.3 to v3.0.0
✓ Successfully upgraded extension
> git remote -v
origin github.com-myorg-EMU:myorg/devops-core (fetch)
origin github.com-myorg-EMU:myorg/devops-core (push)
> gh role
2023/04/29 13:59:11 unable to determine current repository, none of the git remotes configured for this repository point to a known GitHub host
> git -C . config --get-regexp ^remote\.
remote.origin.url [email protected]:myorg/devops-core
remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
> gh auth status
github.com
✓ Logged in to github.com as georgii-iermulnik_myorg (/home/giermulnik/.config/gh/hosts.yml)
✓ Git operations for github.com configured to use ssh protocol.
✓ Token: ghp_************************************
✓ Token scopes: admin:enterprise, admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete:packages, delete_repo, gist, notifications, repo, user, workflow, write:discussion, write:packages Some configuration details if they may help:
[includeIf "gitdir:~/data/github.com/myorg/"]
path = ~/work/.gitconfig.myorg
[url "github.com-myorg-EMU:myorg/"]
insteadOf = g[email protected]:myorg/
This "customization" presumably is the root of the "issue". |
@yermulnik, I pushed up a pre-release just for you. In most cases, the Also, friendly outputs will have the full repo name, including the host. If we're still having difficulties, this will help us debug. Thanks for your patience and your interest in my project! Let me know if this is working for your use case yet. |
@nedredmond Thanks for taking a look into this. Appreciate this.
How do I upgrade to the pre-release version? 🤔 It has no assets except the repo source code archive. Or am I supposed to clone repo and build the binary myself? Also re the #13 (comment) — should I create a new issue for that or that is the intentional behavior? Thanks. |
If this command doesn't work for you, you may need to update your gh cli. Looks like they just added version pinning in January. But yeah, it does look like something weird happened with the release. I fixed it, so the above should work correctly now. |
Oh, TIL! Thanks. > gh extension remove role
✓ Removed extension role
> gh extension install nedredmond/gh-role --pin v3.1.0-pre
✓ Installed extension nedredmond/gh-role
✓ Pinned extension at v3.1.0-pre
> gh role
2023/04/30 23:04:01 unable to determine current repository, none of the git remotes configured for this repository point to a known GitHub host
> gh role -hostname github.com
2023/04/30 23:04:37 unable to determine current repository, none of the git remotes configured for this repository point to a known GitHub host
> gh role -r myorg/devops-core
admin |
> gh --version
gh version 2.28.0 (2023-04-25)
https://github.com/cli/cli/releases/tag/v2.28.0 |
The flag is just "host" but still disappointed it's not working from you. Can you print a friendly version for me? That will let me know what host it thinks your repo is at. |
> gh role -host github.com 2>&1 | head -5
flag provided but not defined: -host
Usage of /home/giermulnik/.local/share/gh/extensions/gh-role/gh-role:
-f Prints a friendly message. Otherwise, prints a machine-readable role name.
-hostname string
The host for which to check roles. If blank, defaults to the gh config. Note that you will need to be be authenticated for the host through the gh cli.
> gh role -f
2023/05/01 01:18:18 unable to determine current repository, none of the git remotes configured for this repository point to a known GitHub host
> gh role -r myorg/devops-core -f
georgii-iermulnik_myorg has admin role in github.com/myorg/devops-core. |
Sorry about the flag confusion. I confused myself. I'm perplexed. If you just run |
Yep, I mentioned this in the second message in this thread. This is the most confusing point about it. > gh repo view | head -2
name: myorg/devops-core
description: This repository is used for DevOps jobs and infrastructure.
Works for me. Thanks for taking time to look into this. What about #13 (comment)? It — in theory — might be related as the resolution of the repo name isn't much of an expectation to be honest. |
I have quite similar setup for my work GH EMU Org as described in cli/cli#6125 (
url
customization viaInstaedOf
via.gitconfig
+ custom SSH config via.ssh/config
for the customized hostname).Eventually (being auth'ed to my work GH EMU Org with GH CLI) when I try and run
gh role
I get this error:2023/04/23 14:51:28 unable to determine current repository, none of the git remotes configured for this repository point to a known GitHub host
Any clue whether this is something to do with
go-gh
package or there's any option withingh-role
to override "autodetected" GH hostname so that API calls use "correct" GH hostname instead of customized one?Thanks
The text was updated successfully, but these errors were encountered: