I have a remote macOS machine with git and GitHub Desktop installed, as well as my SSH public key.

If I connect to the machine via Screen Sharing, open a shell window and try e.g. git pull in my repository it works fine and doesn't ask for the credentials.

However, if I connect to the same machine using SSH and try the same git command, it asks for credentials every time (and works if I give it the correct username and password).

I tried a few suggestions such as this one but everything I do doesn't seem to have any effect when connecting to the machine via SSH.

Is there some sort of a policy of not updating the KeyChain via SSH? Or is it something else?

P.S. I added this to my ~.ssh/config:

Host *
  AddKeysToAgent yes
  UseKeychain yes

Doesn't seem to help.

Also, my git URL is https://github.com/...

  • What happens if you try with an SSH URL instead of an HTTPS URL from GitHub? – Nic Mar 9 '20 at 6:35

Add ForwardAgent yes to your ~/.ssh/config under the UseKeyChain line

  • 1
    Nope, same thing :( – mojuba Dec 18 '19 at 17:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .