SSH Git

本文为原创博客,转载请注明出处:https://blog.csdn.net/q_z_r_s

机器感知
一个专注于SLAM、三维重建、机器视觉等相关技术文章分享的公众号
公众号:机器感知

Checking for existing SSH keys

$ ls -al ~/.ssh

Generating a new SSH key

$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  Generating public/private rsa key pair.
  Enter a file in which to save the key (/home/you/.ssh/id_rsa): [Press enter]
  Enter passphrase (empty for no passphrase): [Type a passphrase]
  Enter same passphrase again: [Type passphrase again]

Adding your SSH key to the ssh-agent

  1. Start the ssh-agent in the background.
  $ eval "$(ssh-agent -s)"
  1. Add your SSH private key to the ssh-agent. If you created your key with a different name,
    or if you are adding an existing key that has a different name,
    replace id_rsa in the command with the name of your private key file.
  $ ssh-add ~/.ssh/id_rsa

Adding a new SSH key to your GitHub account

  1. Copy the SSH key to your clipboard.
$ sudo apt-get install xclip
# Downloads and installs xclip. If you don't have `apt-get`, 
# you might need to use another installer (like `yum`)
$ xclip -sel clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard
  1. In the upper-right corner of any page, click your profile photo, then click Settings.
  2. In the user settings sidebar, click SSH and GPG keys.
  3. Click New SSH key or Add SSH key.
  4. In the “Title” field, add a descriptive label for the new key. For example, if you’re using a personal Mac, you might call this key “Personal MacBook Air”.
  5. Paste your key into the “Key” field.
  6. Click Add SSH key.
  7. If prompted, confirm your GitHub password.

Testing your SSH connection

$ ssh -T git@github.com
# Attempts to ssh to GitHub

Adding or changing a passphrase

$ ssh-keygen -p
# Start the SSH key creation process
Enter file in which the key is (/Users/you/.ssh/id_rsa): [Hit enter]
Key has comment '/Users/you/.ssh/id_rsa'
Enter new passphrase (empty for no passphrase): [Type new passphrase]
Enter same passphrase again: [One more time for luck]
Your identification has been saved with the new passphrase.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值