Setup
- Allow your terminal full disk access.
Example if using iTerm:
System Settings > Privacy & Security > full disk access > switch on for iTerm
-
Enable SSH Server on macOS
Ensure the SSH server is enabled on your macOS system:
sudo systemsetup -setremotelogin on
Verify SSH is enabled:
sudo systemsetup -getremotelogin
The output should indicate that remote login is enabled:
Remote Login: On
-
Set Up SSH Access
Ensure your SSH keys are set up properly:
-
Generate an SSH key pair (if you don't have one, typically you already should have a key):
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
-
Copy the public key to the
authorized_keys
file:cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
Note: the pre existing public key could have a different name. Such as
cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys
-
-
Verify SSH Configuration for Git Access
Ensure the following configurations are set in your SSH configuration file (
/etc/ssh/sshd_config
):PasswordAuthentication no PubkeyAuthentication yes ChallengeResponseAuthentication no
Restart the SSH service to apply the changes:
sudo launchctl stop com.openssh.sshd sudo launchctl start com.openssh.sshd
Backlinks