git 设置 ssh key

12 篇文章 0 订阅

如何向gitHub上上传代码,首先要安装gitHub 桌面版,然而安装了还不行,还要生成一个ssh key。

打开桌面上的git sheel.


然后如下操作:


Windows PowerShell
版权所有 (C) 2015 Microsoft Corporation。保留所有权利。


E:\github\HorizontalScrollView [master +3 ~0 -0 !]>
E:\github\HorizontalScrollView [master +3 ~0 -0 !]> cd~/.ssh
cd~/.ssh : 无法将“cd~/.ssh”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确
保路径正确,然后再试一次。
所在位置 行:1 字符: 1
+ cd~/.ssh
+ ~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (cd~/.ssh:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


E:\github\HorizontalScrollView [master +3 ~0 -0 !]> cd ~/.ssh
C:\Users\Y\.ssh> ssh-keygen -t rsa -C "your_email@youremail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Y/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Y/.ssh/id_rsa.
Your public key has been saved in /c/Users/Y/.ssh/id_rsa.pub.
The key fingerprint is:
e8:8a:a7:63:5c:f8:3b:36:5b:2d:0d:6d:89:c8:62:20 your_email@youremail.com
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|E                |
|.. . . + .       |
|  o.o + S        |
| ..... =         |
| . o  + o        |
|  +.*o .         |
| .o=+=           |
+-----------------+
C:\Users\Y\.ssh> ssh -T git@github.com
Warning: Permanently added 'github.com,192.30.252.128' (RSA) to the list of known hosts.
Hi xiaosenlin! You've successfully authenticated, but GitHub does not provide shell access.
C:\Users\Y\.ssh> git config --global user.name "Firstname Lastname"
C:\Users\Y\.ssh> git config --global user.email "your_email@youremail.com"
C:\Users\Y\.ssh>

成功后:













修改 第二版 笔记:

Windows PowerShell
版权所有 (C) 2015 Microsoft Corporation。保留所有权利。

C:\Users\Y\AppData\Local\GitHub\TutorialRepository_d0aa732a2b4666b3029e2320f1a06cd39e99c9fc\new-repo [master]> cd ~/.ssh
C:\Users\Y\.ssh> ssh-keygen -t rsa -C "sunshanai@126.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Y/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Y/.ssh/id_rsa.
Your public key has been saved in /c/Users/Y/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:7cPGxIMkUPojxJ5myWrzQLNk+l91uqVyql77CfaVdSg sunshanai@126.com
The key's randomart image is:
+---[RSA 2048]----+
|    ...          |
|   . o           |
|    + . .        |
|   + + o +   .   |
|  = O o S E o .  |
| = * . o B = .   |
|. *   = . X      |
| o + +.+.B .     |
|  .o=.o=*        |
+----[SHA256]-----+
C:\Users\Y\.ssh> ssh -T git@github.com
Warning: Permanently added 'github.com,192.30.252.130' (RSA) to the list of known hosts.
Hi xiaosenlin! You've successfully authenticated, but GitHub does not provide shell access.
C:\Users\Y\.ssh> git config --global user.name "xiaosenlin"
C:\Users\Y\.ssh> git config --global user.email "sunshanai@126.com"
C:\Users\Y\.ssh>


2016年11月27日重装系统第三版

Windows PowerShell
版权所有 (C) 2015 Microsoft Corporation。保留所有权利。

C:\Users\Y\Documents\GitHub> cd ~/.ssh
C:\Users\Y\.ssh> ssh-keygen -t rsa -C "your_email@youremail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Y/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Y/.ssh/id_rsa.
Your public key has been saved in /c/Users/Y/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:sI0UyZ74whxlmsoZ/m0vvU6WHSBXxDaS3pMJeoi4Zhw your_email@youremail.com
The key's randomart image is:
+---[RSA 2048]----+
|     ... +o      |
|      =.+.+      |
|   . O+=o= +     |
|  E *.=Bo.=      |
| + O oo.S ..     |
|  X + .  o .     |
| o . o .+ .      |
|    . +o.        |
|     . ++.       |
+----[SHA256]-----+
C:\Users\Y\.ssh> ssh -T git@github.com
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
Hi xiaosenlin! You've successfully authenticated, but GitHub does not provide shell access.
C:\Users\Y\.ssh> git config --global user.name "Firstname Lastname"
C:\Users\Y\.ssh> git config --global user.email "your_email@youremail.com"
C:\Users\Y\.ssh>


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值