SSH set up for git on Mac OS
Check the ssh client version.
ssh -V
List the contents of ~/.ssh directory. Create this .ssh directory if doesn’t exist in your home directory.
ls -a ~/.ssh
Go to the ~/.ssh directory, and create identitiy files. When promoted for file location, name or passphrase, press enter for default location, name and no passphrase. Or enter the location, name and passphrase of your choice.
cd ~/.ssh ssh-keygen
Check if the ssh-agent is running.
ps -e | grep [s]sh-agent
Start the ssh-agent if it isn’t running.
ssh-agent /bin/bash
Load the identity files in ~/.ssh create by ssh-keygen
above into ssh-agent. The name of the identitify file can be someting else instead of id_rsa if you chose your own name instead of the default one.
ssh-add ~/.ssh/id_rsa
Load the identity files automatically on OS restart.
ssh-add -K ~/.ssh/id_rsa_bb
Show the identity key files in the ssh-agent
ssh-add -l
To install the public key on remote repository host server, such as github or bitbucket. Copy the content of public file and save it to github or bitucket account.
cat ~/.ssh/id_rsa.pub
To change from https to ssh
git remote -v git remote set-url origin git@my-gitserver.com:Username/project-name.git
Search within Codexpedia
Search the entire web