Skip to content

Instantly share code, notes, and snippets.

@rasor
Last active June 18, 2021 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rasor/3970bf55838c0f53f77ba2e5f350ed66 to your computer and use it in GitHub Desktop.
Save rasor/3970bf55838c0f53f77ba2e5f350ed66 to your computer and use it in GitHub Desktop.
#!/bin/bash
# ~/.bash_profile
# Add your SSH key to SSH Agent
eval `keychain --eval --agents ssh id_rsa_winuser1`
# Now you don't have to add your SSH key to agent (`ssh-add`) before you commit to github.
# end
#!/bin/bash
# ~/.bashrc
# end
#ini
# ~/.gitconfig
[user]
name = winuser1
email = winuser1@example.xx
# end
# ~/.ssh/config
Host *
UseKeychain yes
AddKeysToAgent yes
IdentityFile ~/.ssh/id_rsa_winuser1
Host github.com
Hostname github.com
IdentityFile ~/.ssh/id_rsa_winuser1
# end
#!/bin/bash
# ~/.ssh/createkey.sh
# Check for existing SSH keys
ls -al ~/.ssh
# Are there any you want to reuse?
# I want to generate a new key pair
cd ~/.ssh
ssh-keygen -t rsa -b 4096 -C "winuser1@example.xx"
# Generating public/private rsa key pair.
# Enter file in which to save the key (/home/youruserid/.ssh/id_rsa): id_rsa_winuser1
# Enter passphrase (empty for no passphrase):
# Enter same passphrase again:
# Your identification has been saved in id_rsa_winuser1.
# Your public key has been saved in id_rsa_winuser1.pub.
# The key fingerprint is:
# SHA256:X4uMb123456789012345678901234567rWz12345678 winuser1@example.xx
# The key's randomart image is:
# +---[RSA 4096]----+
# Avoid error "Can't clone git repo and getting error ssh_askpass: exec(/usr/bin/ssh-askpass): No such file or directory Host key verification failed"
# https://stackoverflow.com/questions/52711525/cant-clone-git-repo-and-getting-error-ssh-askpass-exec-usr-bin-ssh-askpass
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
# github.com:22 SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.8
ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts
ssh-keyscan -t rsa bitbucket.org >> ~/.ssh/known_hosts
ssh-keyscan -t rsa ssh.dev.azure.com >> ~/.ssh/known_hosts
# end
{
"comment.gist.filenameandlocation": "C:\Users\winuser1\AppData\Roaming\Code\User\settings.json",
"comment.gist.purpose": "Set VSCode terminal to bash",
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
"git.enableSmartCommit": true,
"gitlens.views.repositories.files.layout": "tree",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment