Introduction
I recently got a new Macbook Air M1 and at my new customer i wanted to git pull certain repo’s at a remote server.
This didnt really work. So i figured it all out. Underneath you can find all settings for your ssh config
, ssh-agent
.
Add the correct parameter to your ssh config
Edit your ssh config via vim ~/.ssh/config
and add the following (change your remote server accordingly)
Host <your-remote-host>
User <username>
ForwardAgent yes
UseKeychain yes
IdentityFile ~/.ssh/keys/<your-ssh-key>
Please note the ForwarAgent yes; this will allow your key to be forwarded by the ssh-agent Also UseKeychain yes; This is different than on linux, since keychain will be your key wallet on macos
Install ssh-agent
brew install ssh-agent
Add the key to ssh-agent
ssh-add ~/.ssh/keys/<your-ssh-key>
Now make sure that the apple key chain is used:
ssh-add --apple-use-keychain --apple-load-keychain
note: this is vital!
Edit the zshrc
A thing i initially forgot was to add the ssh-agent plugin to zshrc:
plugins=(git colored-man-pages colorize pip python brew macos ssh-agent)
note: there are other plugins i personally use, ofcourse we are talking about ssh-agent