Github使用(配置SSHkey)
来源:互联网 发布:dns协议udp端口号 编辑:程序博客网 时间:2024/06/09 20:51
当你第一次使用Git的clone
或者push
命令连接GitHub时,会得到一个警告:
The authenticity of host 'github.com (xx.xx.xx.xx)' can't be established.RSA key fingerprint is xx.xx.xx.xx.xx.Are you sure you want to continue connecting (yes/no)?
这是因为Git使用SSH连接,而SSH连接在第一次验证GitHub服务器的Key时,需要你确认GitHub的Key的指纹信息是否真的来自GitHub的服务器,输入yes
回车即可。
Git会输出一个警告,告诉你已经把GitHub的Key添加到本机的一个信任列表里了:
Warning: Permanently added 'github.com' (RSA) to the list of known hosts.
这个警告只会出现一次,后面的操作就不会有任何警告了。
如果你实在担心有人冒充GitHub服务器,输入yes
前可以对照GitHub的RSA Key的指纹信息是否与SSH连接给出的一致。
Github使用(配置SSHkey)
这一篇博客主要讲解怎么在windows环境下配置SSH key,以及添加到gubhub帐号中。官方教程传送门Generating SSH keys
SSH keys are a way to identify trusted computers, without involving passwords.
Step 1:检查电脑中是否已经有已存在的SSH key
首先我们需要检查电脑中已存在的SSH key,打开Git bash 输入下面命令:
123
yaohp-PC MINGW64 ~/Desktop$ ls -al ~/.sshls: cannot access /c/Users/yaohp/.ssh: No such file or directory
报这个错,表示电脑不存在SSH key
如果电脑中存在SSHkey的话将会列出类似下面的目录结构
1234
id_dsa.pubid_ecdsa.pubid_ed25519.pubid_rsa.pub
~/. 表示当前目录,注意先cd 到当前 .ssh目录 然后再开始下面生成ssh key的步骤
Step 2:生成一个新的SSH key
在Git bash终端输入下面命令
12345678910111213141516171819202122
yaohp-PC MINGW64 ~/Desktop$ ssh-keygen -t rsa -b 4096 -C "youremail@qq.com"Generating public/private rsa key pair.Enter file in which to save the key (/c/Users/yaohp/.ssh/id_rsa): filenameEnter passphrase (empty for no passphrase):Enter same passphrase again:Your identification has been saved in filename.Your public key has been saved in filename.pub.The key fingerprint is:SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx youremail@qq.comThe key's randomart image is:+---[RSA 4096]----+| .. ..o...+|| ..+ . . ..|| ..o o . .|| .E. . . . || ....S.+ . o || +. o+xxx =.|| o . =.+.=+ =|| =.+o=* || .===+o.|+----[SHA256]-----+
出现上面这样就代表SSH key生成成功了,直接进入Step 3。
Step 3:登录git 设置ssh key
登录git账号点击头像进入个人中心---------》点击SSH and GPG keys------------>点击New SSh keytitle随便写一个,然后key 的内容,则进入.ssh目录中打开刚才你生成的 xx.pub,复制里面的内容黏贴到key中保存
Step 4:测试连接
1234567
yaohp@Lenovo-PC MINGW64 ~$ ssh -T git@github.comHi xxxxxxx! You've successfully authenticated, but GitHub does not provide shell access.连接成功参考链接:https://www.yaohepeng.com/2015/05/08/Github%E4%BD%BF%E7%94%A8%EF%BC%88%E9%85%8D%E7%BD%AESSHkey%EF%BC%89/
0 0
- Github使用(配置SSHkey)
- github中配置SSHKEY
- github 配置有共有sshkey
- github sshkey
- Github 学习之sshkey创建(一)
- 配置sshkey
- github结合TortoiseGit使用sshkey,无需输入账号和密码
- github结合TortoiseGit使用sshkey,无需输入账号和密码
- github结合TortoiseGit使用sshkey,无需输入账号和密码
- github结合TortoiseGit使用sshkey,无需输入账号和密码
- Github添加sshkey
- 设置github的sshkey
- Git与Github基础使用之--添加本地sshkey到github
- github创建多个sshkey
- git(3)sshkey
- 在cambridge上添加github sshkey方法:
- GitHub -- GitHub配置与使用
- mac多个sshkey配置方案
- bootstrap--table,select2及x-editable的使用小结
- 红宝书 第22章整理——高级技巧(绑定+拖拽)
- 记录一下 android ListView代码设置分割线
- likehood function
- c# Task返回值
- Github使用(配置SSHkey)
- Android加载WebView
- POJUltra-QuickSort(归并排序)
- 转载BW笔记
- 从零开始写javaweb框架(第二章)—— 所遇到的问题 与 解决方法
- Android之兼容平板
- .NET-一种实现表格数据滚动显示的方法
- 正则
- hive启动报错,找不到spark的jar包们