git set ssh key code example

Example 1: ssh github generate key

$ ssh-keygen -t rsa -b 4096 -C "[email protected]"

Example 2: git specify ssh key for repo

# Add this to ~/.ssh/config
Host github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa_github

Example 3: git change ssh key

git config core.sshCommand "ssh -i ~/.ssh/id_rsa_example -F /dev/null"
git pull
git push

# Other way
edit .git/config file like:

[core]
	sshCommand = ssh -i ~/.ssh/id_rsa_example -F /dev/null

Example 4: github ssh-agent

$ ssh-add -K ~/.ssh/id_rsa

Example 5: terminal git add ssh key

$ ssh-add ~/.ssh/id_rsa

Example 6: what is ssh key in github

$ cd ~/.ssh
$ ls

Tags:

Misc Example