Skip to content

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

Open
@thomazbron

Description

@thomazbron

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions