SSH
SSH Key Setup & Pushing First Project
MacOS or Linux:
Check for SSH keys
ls -al ~/.ssh
If there are any ssh keys, this will show them.
If you don’t have a ~/.ssh directory, go ahead and make one
mkdir ~/.ssh
To setup a ssh key:
ssh-keygen -t rsa
which will prompt you to select a location for the keys.
The default is the ~/.ssh directory.
If this is your first ssh key, and you choose the default, hit and enter.
Press enter at “Enter file in which to save the key (/home/username/.ssh/id_rsa)”
Choose Y to overwrite.
At “Enter passphrase (empty for no passphrase): Enter same passphrase again:”
The resulting files are the private key which is id_rsa, and the public key which is id_rsa.pub.
To get the public key : (for Linux)
cat ~/.ssh/id_rsa.pub
(for MacOS)
pbcopy < ~/.ssh/id_rsa.pub
Sample private key output
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAn5EYBOxjQ6gPDmhQi1P2tQIKRVQc7XjzClkgjfCynAFCXwwj
8U1iBY4jwiD/e7cpHZ6gZzdu3Ty965RktoVB6rAtqh4COGrgR/+TfHqNnqS9jF09
zff3vruhGKoWSMT3PIBei1r7mngVEFbb8fpGZZ7Ey2x1yVY2Ez7XKlh3QgV8EmNE
bDKUwXguUKpXxz6C5vHnbJh1L9Yx+KB5Lll+RBZOLhSGNmqz/CcyPYTiucR64u9E
BiozlC8Oyzx/yiFHGRHLMUcwqQx2zT/AdbVExPx5hh63Gs3lVKEkHZVtaihmMXTb
N+OSmiJZ3eb37b2GQ2Nt4xwzt5sTti/CW4OYLwIDAQABAoIBABivntKsK5M8/c9R
zhwwCjvoq+Qb5jnK+3a/YSz0bv15qGYB/9GGEkMfwWJ4Lm5aYM8HSnONfOZXTl6S
VFe0S43PKUz7Y6GZZ9ZEY49WjmS1K/Xs2i0vfthe3hBlqYxy1gOvBqQdu7crvrwy
9ByPlNVQfxPJpChcyCRRy3c8q6p1A7IakK/ylVht3GKCfv0OxZu5iYnQsF+nwBqu
2zNl2/QnQgr5bV+xLqlDBq3vL8kaA2HSatuG1HRKPwkD9ev9YeV40Az0XJVx0zeU
MRrz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g5YPU/ywPizeyqzoWo7o0pp823LIgiFPN9uyiWdwdB3+Qc7zfcKNYuXxRV5U6Ne3znXQRxiMi05D0jDv682JRE5NQEXF bob@localbob
copy the public key output and paste in your code.vt.edu settings/ssh keys “key” box.
Secondary SSH Key
if you already have a key and want to create another, use the following, replacing
ssh-keygen -f ~/.ssh/<username>
“Enter passphrase (empty for no passphrase): Enter same passphrase again:”
to view that public key: (for linux)
cat ~/.ssh/<username>.pub
(for mac os)
pbcopy < ~/.ssh/<username>.pub
Windows
download and install putty: http://www.putty.org/
to generate key: https://www.ssh.com/ssh/putty/windows/puttygen
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.