1, vscode打开terminal,生成RSA密钥,并查看蜜月
PS D:\\code\\SQL> git init
Reinitialized existing Git repository in D:/code/SQL/.git/ PS D:\\code\\SQL\> git config --global user.name amadeus
PS D:\\code\\SQL\> git config --global user.email vegas_lee@163.com
PS D:\\code\\SQL\> ssh-keygen -t rsa -C "vegas_lee@163.com" Generating public/private rsa key pair.
Enter file in which to save the key (C:\\Users\\vegas/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your public key has been saved in C:\\Users\\vegas/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:JTEfU8+j6+dxrYqoiCy+jbUNHUXCQGvF3rY/6FFjC5E vegas_lee@163.com
The key's randomart image is:
+---\[RSA 3072\]----+
| .o+o .o o.. |
| ooo .+ o o |
| o. .E. o + |
| . ..o.o . . |
| ...S+ . |
| . ..\+ o . .|
| o . .o. . . o|
|..\+.\+. ..\+ o .+ |
|.=+o..oo. o o+o |
+----\[SHA256\]-----+ PS D:\\code\\SQL\> cat ~/.ssh/id_rsa.pub ssh-rsa me5Aomus6IQmsIRT+tGpWsSSuKhe7WrJhPQmuDl vegas_lee@163.com
PS D:\\code\\SQL>
2,打开github网站,进入仓库,进入setting,设置deploy keys,将id_rsa.pub中的内容粘贴进去即可。
3,terminal绑定本地文件夹和GitHub仓库,并做连接测试:
PS D:\\code\\SQL> git remote add ztsql git@github.com:vegaslee/sql.git
PS D:\\code\\SQL\> ssh -T git@github.com
Hi vegaslee/sql! You've successfully authenticated, but GitHub does not provide shell access.
4,做一次推送
PS D:\\code\\SQL> git push --force ztsql master
Enumerating objects: 110, done.
Counting objects: 100% (110/110), done.
Delta compression using up to 8 threads
Compressing objects: 100% (107/107), done.
Writing objects: 100% (110/110), 68.98 KiB | 255.00 KiB/s, done.
Total 110 (delta 18), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (18/18), done.
To github.com:vegaslee/sql.git \* \[new branch\] master -> master
PS D:\\code\\SQL>
标签:PS,code,vscode,使用,rsa,github.211014,SQL,git,com
From: https://www.cnblogs.com/amadeuslee/p/18675320