如何向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>