How To Implement Keychain 🔐

The Problem

If you are sick of re-entering your SSH passphrase per login shell 😒…

eval $(ssh-agent -s )
ssh-add ~/.ssh/id_rsa
# re-enter passphrase
SSH-Agent:

Keychain will allow you to enter your SSH passphrase per system reboot, 😲

How???

Keychain will automatically re-use your pre-existing ssh-agent process and have instant access to any pre-loaded keys and passphrases.

Keychain:

Summary of Steps

Below are the exact steps I took in the Keychain playlist.

You may have to adjust a few parameters to your environment but the Linux commands should be the same.

# Generate your SSH keypair (Public/Private)
# Public Key ends with a *.pub
# Private Key has no extension
ssh-keygen

# Copy Public Key to host(s)
ssh-copy-id -i /home/user1/.ssh/id_rsas.pub user1@remote1

# Test Private Key
ssh -i /home/user1/.ssh/id_rsa user1@remote1

#############################
#
# Legacy Method: NO KEYCHAIN 
#
#############################
eval $(ssh-agent -s )
ssh-add /home/user1/.ssh/id_rsa
# View loaded keys
ssh-add -l
# Test "agent process"
ssh -i /home/user1/.ssh/id_rsa user1@remote1

#############################
#
# NEW Method: KEYCHAIN! 🙂
#
#############################
# Install keychain
sudo apt-get install keychain

#####################
# UPDATE: 01/12/2026
# Add the following to "~/.bashrc" and keychain will look
# for and use your pre-existing ssh-agent every time.
#####################
eval `keychain --eval --agents ssh /home/user1/.ssh/id_rsa`

# Test keychain
ssh user1@remote1


Keychain Concepts

Here I explain the concepts that make up ssh key authentication and keychain:


Demonstration

Here, I show you how to actually implement keychain:

What IS Personal Responsibility?

If you read plenty of personal development literature, you always here the concept of Personal Responsibility.

But what does it REALLY MEAN and how do you practice this???


Here’s one way to ACTUALLY PRACTICE Personal Responsibility:

Don’t focus on resources, focus on resourcefulness

Can’t remember and too lazy to look up

If you focus on recourses, you’re likely to focus on what you DON’T HAVE. Essentially deferring the solution-seeking.

If you focus on resourcefulness, you’re looking at what you DO HAVE and making the most of that. And exercising your free agency.

This takes creativity and a little bit of courage.


Keep in mind though, that

Wisdom is the timely application of knowledge

@DandapaniLLC (Twitter)

Sometimes you DO need more resources; and sometimes resourcefulness is not enough.

But don’t ASSUME you always need more resources before you’ve had an honest look at yourself first.

Sometimes, just sometimes: Good enough is good enough.

Git Merge Conflicts

Merge conflicts can show up when you do a ‘git-merge’ or a ‘git-rebase’:

https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging

One way you can “anticipate” a git merge is with the ‘diff’ command

Here’s some bash pseudo code using command substitution:

diff -y <(git show branchA:file.txt) <(git show branchB:file.txt)

Remember though ☝️

A diff will always yield results, that’s what a patch is..

The key is when the SAME LINES are being changed: That’s the conflict! 😉

If the lines from diff don’t overlap…you can probably assume the merge or rebase won’t produce a conflict

(at least, for the file you looked at😊)

Git Rebase Lesson

I wrote a script to automate the creation of two divergent git branches…’main’ and ‘feature’.

When I rebased ‘feature’ onto ‘main’..no worked was “saved”.

The following code:

git checkout feature
git rebase main -i

even show ‘noop’ in the text editor.

Turns out, my code was creating duplicate patches on each divergent branch (here’s how to reproduce it if your interested, github link)

So when I rebased, git skips “already introduced patches”.

My reaction after 2 hours of reaching this finding: