Skip to content
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

gh repo clone not working with multiple accounts on plugin #495

Open
thomazbron opened this issue Oct 13, 2024 · 1 comment
Open

gh repo clone not working with multiple accounts on plugin #495

thomazbron opened this issue Oct 13, 2024 · 1 comment

Comments

@thomazbron
Copy link

thomazbron commented Oct 13, 2024

Platform or tool

Github

Desired or expected behavior

Possibility of cloning, fetching and pushing with multiple accounts.

Current behavior

When cloning with one of the accounts it shows that repository not found:

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
failed to run git: exit status 128

Relevant log output

- `.gitconfig` already have the credentials:

[credential "https://github.com"]
        helper = 
        helper = op plugin run -- gh auth git-credential
[credential "https://gist.github.com"]
        helper = 
        helper = op plugin run -- gh auth git-credential
  • Plugin is correctly configured inside folder .op/plugins/gh.config
  • gh auth status return the correct account:
github.com
  ✓ Logged in to github.com account thomazbron (GITHUB_TOKEN)
  - Active account: true
  - Git operations protocol: ssh
  - Token: ghp_************************************
  - Token scopes: 'admin:enterprise', 'admin:gpg_key', 'admin:org', 'admin:org_hook', 'admin:public_key', 'admin:repo_hook', 'admin:ssh_signing_key', 'delete_repo', 'gist', 'notifications', 'project', 'repo', 'user', 'workflow', 'write:discussion'
  • op plugin inspect gh seems correct:
GitHub CLI

Configured Aliases

✔ Alias for "gh" configured
✔ Aliases sourced (/home/thomaz/.config/op/plugins.sh)

Configured Credentials

✔ Configured for directory "/home/thomaz/repos/born": 
CREDENTIAL TYPE                 ITEM                 VAULT
GitHub Personal Access Token    Github Born Token    Born
  • ~/.ssh/config is configured according to documentation:
Host *
        IdentityAgent ~/.1password/agent.sock

# Personal GitHub
Host tnex
        HostName github.com
        User git
        IdentityFile ~/.ssh/tnex.pub
        IdentitiesOnly yes

# Work GitHub
Host born
        HostName github.com
        User git
        IdentityFile ~/.ssh/born.pub
        IdentitiesOnly yes
  • Keys permissions seems fine:
.rw-------  80 thomaz  2 Sep 13:33 󰷖 born.pub
.rw------- 262 thomaz  2 Sep 13:34  config
.rw------- 828 thomaz 13 Oct 01:43 󰣀 known_hosts
.rw-------  80 thomaz  2 Sep 13:33 󰷖 tnex.pub

  • ssh-add -l correctly shows my keys:
256 SHA256:... Tnex (ED25519)
256 SHA256:... Github Born (ED25519)
  • Cloning on my personal account work fine as expected, the issue is with the Work account, also I have this same config in another computer and it work flawlessly! Any help will be appreciated as I already tried "everything".


### op CLI version

2.30.0
@thomazbron
Copy link
Author

Just found out that changing the order in agent.toml work as expected (my work key is in another vault):

[[ssh-keys]]
vault = "Born"

[[ssh-keys]]
vault = "Personal"

But now my personal key does not work, seems that only the first entry is being used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant