Why is 'git push' and 1Password not working?

315 Views Asked by At

I created a repository on GitHub.com, and cloned it locally with no issues. Then, I added folders and files to the repository and added all contents to the local repo with no issues.

Finally, I committed the updates and 1Password authenticated the commit with no issues. However, when I issue a 'git push' command GitHub is not authenticating it with 1Password.

STEPS I HAVE TAKEN

I created a ed25519 key with 1Password and added it to GitHub as signing and authentication keys. Locally I configured 1Password and Github successfully, and confirmed allowed_signers with

ssh-add -L

I confirmed the local ssh key with

git commit --allow-empty -message="Testing SSH Signing"

Finally, when I clone a repository, 1Password prompts me to authenticate and it's a success. However, when I issue 'git push' command I get this error

[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights

What am I missing?

[UPDATES]

I should also mention I've tried to use both HTTPS and SSH url for the repo and I get the same error message.

Also, I tried these commands with no success:

git push -u origin master
error: failed to push some refs to 'github.com:username/repositoryName.git'
git push -u origin
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I checked which ssh key is being used with

ssh -vvv github.com:username/reponame.git

and I got this message (maybe I'm onto something here)

OpenSSH_9.0p1, LibreSSL 3.3.6
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug2: resolve_addr: could not resolve name github.com:username/reponame.git as address: nodename nor servname provided, or not known
debug1: resolve_canonicalize: hostname github.com:username/reponame.git is an unrecognised address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/Users/me/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/Users/me/.ssh/known_hosts2'
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to github.com:username/reponame.git port 22.
1

There are 1 best solutions below

0
On

Found the solution for my environment.

Although I have 1Password SSH agent configured in Libray/Group/..., I also needed to have agent forwarding enabled in my ~/.ssh/config like this

Host *
    IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
    ForwardAgent yes

Hopefully, this will be helpful to someone else in the future.

Credit: https://1password.community/discussion/128126/ssh-agent-forwarding