Git sync problem

I’m encountering issues with the Logseq Git plugin when trying to sync my notes. The error message I’m seeing is:

Git pull --rebase failed
/Users/tiger/.homebrew/opt/ssh-askpass/bin/ssh-askpass:1644:1780: execution error: The specified button does not exist. (-50)
no such identity: /Users/tiger/.ssh/id_github: No such file or directory
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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

Context::

  1. SSH Configuration:
  • I have multiple SSH keys in my ~/.ssh directory:
total 56
drwx------    9 tiger  staff   288 May 28 11:31 .
drwxr-xr-x@ 136 tiger  staff  4352 May 29 23:05 ..
-rw-r--r--    1 tiger  staff   439 May 29 23:16 config
-rw-------    1 tiger  staff  3434 May 28 12:03 id_rsa
-rw-r--r--    1 tiger  staff   748 May 28 12:03 id_rsa.pub
-rw-------    1 tiger  staff  3434 May 28 11:31 id_rsa_new
-rw-r--r--    1 tiger  staff   748 May 28 11:31 id_rsa_new.pub
-rw-------    1 tiger  staff  2985 Mar 28 08:01 known_hosts
-rw-------    1 tiger  staff  2249 Mar 28 08:01 known_hosts.old
  1. My ~/.ssh/config file is configured as follows:
# Configuration for GitHub
Host github.com
  HostName github.com
  IdentityFile ~/.ssh/id_rsa

# Configuration for self-hosted Gitea
Host 192.168.0.105
  HostName 192.168.0.105
  User root
  IdentityFile ~/.ssh/id_rsa_new

# Configuration for another website
Host mywebsite.com
  HostName mywebsite.com
  User git
  Port 2222
  IdentityFile ~/.ssh/id_rsa_new
  1. SSH authentication ( ssh -T git@github.com ) works fine

  2. can perform git pull and git push operations without issues in the terminal

  3. restarted Logseq to ensure configuration changes take effect.

There seems to be an issue with the Logseq Git plugin not recognizing the SSH keys as configured in the ~/.ssh/config file. The plugin attempts to use /Users/tiger/.ssh/id_github, which does not exist.

Question

How can I configure the Logseq Git plugin to correctly use the SSH keys specified in my ~/.ssh/config file, avoiding the hardcoded path errors? Thanks a lot.

If you’re using the Logseq Git plugin (logseq-git) and need to configure it to use your ~/.ssh/id_rsa SSH key try this:

First add the identity:

ssh-agent bash
ssh-add ~/.ssh/id_rsa

Then set git to use this config globally:

git config --global core.sshCommand "ssh -i ~/.ssh/id_rsa"

Test it out:

ssh -T git@github.com

You should see this message: “Hi ! You’ve successfully authenticated, but GitHub does not provide shell access.”

You should be good to go!