`
openxtiger
  • 浏览: 151153 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Generating SSH Keys

 
阅读更多

While we recommend HTTPS because it is generally easier to set up, you can also use SSH keys to establish a secure connection between your computer and GitHub. The steps below will walk you through generating an SSH key and then adding the public key to your GitHub account.

Step 1: Check for SSH keys

First, we need to check for existing ssh keys on your computer. Open up Terminal and run:

cd ~/.ssh
ls
# Lists the files in your .ssh directory

Check the directory listing to see if you have a file named either id_rsa.pub or id_dsa.pub. If you don't have either of those files go to step 2. Otherwise, you already have an existing keypair, and you can skip to step 3.

Step 2: Generate a new SSH key

To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.

ssh-keygen -t rsa -C "your_email@example.com"
# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.
# Enter file in which to save the key (/home/you/.ssh/id_rsa):
ssh-add id_rsa

Now you need to enter a passphrase.

# Enter passphrase (empty for no passphrase): [Type a passphrase]
# Enter same passphrase again: [Type passphrase again]

Which should give you something like this:

# Your identification has been saved in /home/you/.ssh/id_rsa.
# Your public key has been saved in /home/you/.ssh/id_rsa.pub.
# The key fingerprint is:
# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com

 

Run the following code to copy the 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

 

分享到:
评论

相关推荐

    Solaris SSH配置和原理

    将公钥上传到远程服务器的`~/.ssh2/authorized_keys`文件中。 ##### 2. 使用SSH进行连接 连接远程服务器时,无需输入密码,而是通过密钥对进行身份验证。 ```bash local# ssh remote.pku.edu.cn Passphrase for ...

    两台linux机器之间ssh不需要密码详解

    - **权限管理**:确保`.ssh`目录及`authorized_keys`文件的权限设置正确,避免非授权用户访问。 - **定期审核**:定期检查`authorized_keys`文件中的公钥列表,移除不再使用的公钥,确保系统的安全性。 #### 结论 ...

    免密登录SSH

    cat ~/.ssh/id_rsa.pub &gt;&gt; ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys ``` 3. **测试免密登录**:在本地机上尝试使用新的私钥进行免密登录。 - 新建一个SSH会话,输入服务器的IP地址、用户名...

    Linux配置远程SSH无密码登录

    使用`ssh-copy-id`命令将本地主机的公钥复制到远程主机的`~/.ssh/authorized_keys`文件中,以允许无密码登录。例如,如果远程主机IP为192.168.0.178,运行: ``` [root@test ~]# ssh-copy-id -i ~/.ssh/id_rsa....

    详解SSH如何配置key免密码登录

    使用`scp`命令将公钥`id_rsa.pub`复制到远程主机的对应用户目录下的`.ssh/authorized_keys`文件。如果远程主机的`.ssh`目录或`authorized_keys`文件不存在,需要先创建它们。 ```bash [azuo1228@test-server ....

    linux scp传输不用密码

    用户在本地主机上生成一对RSA密钥(公钥与私钥),然后将公钥复制到远程服务器的`~/.ssh/authorized_keys`文件中。当用户尝试连接远程服务器时,服务器会使用已存储的公钥来验证用户的私钥,如果匹配成功,则允许...

    github配置使用指南

    https://help.github.com/articles/generating-ssh-keys/ 3.初始化用户名,邮箱 $ git config –global user.name “defnngj”//给自己起个用户名 $ git config –global user.email “defnngj@gmail.com”//填写自己...

    详解ssh免密码登录配置方法(图示加命令)

    我们先使用usera 登录 serverA 服务器 [root@serverA ~]# su - usera ...[usera@serverA ~]$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/usera/.s

    使用密钥对免密操作远程服务器

    [root@node1 ~]# vim /root/.ssh/authorized_keys ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqx16gwciSttzoc/rgtKrE45kLl7vTpmvc5qDvzB6LWEm5jp9b/SdUy0qBVx5yZ5/nBmkqUbDZQBsG//Qi4rw8w7kIc14IOxn0U4s0bG/3...

    linux redhat下异地备份

    - 在服务器B的`.ssh`目录下创建或修改`authorized_keys`文件,将`id_rsa.pub`的内容追加进去。 - 如果有多个服务器需要相互之间实现无密码访问,则将各服务器的`id_rsa.pub`内容追加到`authorized_keys`文件中即可...

    陇东学院云计算2班贾永康20240717

    这里使用`ssh-copy-id`命令将当前用户的公钥复制到目标主机的`~/.ssh/authorized_keys`文件中,从而实现从当前主机到目标主机的免密登录功能。需要注意的是,`-p 22`参数指定了SSH服务端口为22,默认情况下可以省略...

    aws-ha-webapp-terraform

    就我而言,我使用ssh-keygen命令,如下所示: ssh-keygen -t rsaGenerating public/private rsa key pair.Enter file in which to save the key (/home/qaizar/.ssh/id_rsa): ./keys/terraformEnter passphrase ...

    oracle asm rac

    一、安装前准备 磁盘规划 使用iscsi共享磁盘做成raw设备 Vote_OCR /dev/sdb1 /dev/raw/raw1 Vote_OCR /dev/sdb2 /dev/raw/raw2 Vote_OCR /dev/sdb3 /dev/raw/raw3 Vote_OCR /dev/sdb5 /dev/raw/raw4 ...

    路由器配置实例--100例

    Generating RSA Keys... [OK] Router(Config)#&lt;/P&gt;&lt;P&gt;2、 TCP SYN的防范。如: A: 通过访问列表防范。 Router(Config)# no access-list 106 Router(Config)# access-list 106 permit tcp any 192.168.0.0 0.0.0....

    Python Cookbook, 2nd Edition

    Building a Dict from a List of Alternating Keys and Values Recipe 4.13. Extracting a Subset of a Dictionary Recipe 4.14. Inverting a Dictionary Recipe 4.15. Associating Multiple Values with ...

    计算机网络第六版答案

    It adds header to each chunk, thereby generating multiple packets from the file. The header in each packet includes the IP address of the destination (end system B). The packet switch uses the ...

Global site tag (gtag.js) - Google Analytics