1.新增一个repository(此处命名为blog)点击头像--打开setting
图02.'SSH and GPG keys'--generating ssh keys(查看帮助)-'Generating a new SSH key and adding it to the ssh-agent'
图13.复制此条代码.email地址要改为自己的,但是不影响使用,只是作为留下自己的联系方式用.复制代码的时候注意,复制到了回车之后粘贴在git bash中会自动运行.
图2ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
4.在git bash里面要出现下面的字段.出现红框中字段时,按回车三下,直到看见气泡形状的字段就是成功了.
图3L@DESKTOP-U5B0Q2U MINGW64 /c/vsc-demo/blog $ ssh-keygen -t rsa -b 4096 -C "maolpha@hotmail.com" Generating public/private rsa key pair. Enter file in which to save the key (/c/Users/1/.ssh/id_rsa): Created directory '/c/Users/1/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /c/Users/1/.ssh/id_rsa. Your public key has been saved in /c/Users/1/.ssh/id_rsa.pub. The key fingerprint is: SHA256:oggdWqu0RHB9e62MsIIfYWTwz4RSoV0dtD7UT1vWHwQ maolpha@hotmail.com The key's randomart image is: +---[RSA 4096]----+ |o.+o.oo. E.. | |.*oo. oo .. | |o+* ..o.... o .. | |.=o*.o. .o.+ ..| |o=o.oo++S.o .| |+o+....oo | |.o.o. | | . | | | +----[SHA256]-----+
5.继续输入如下命令行($都是自带的,直接从cat开始打就可以)
$ cat ~/.ssh/id_rsa.pub
会弹出图3下半部分的代码,复制该段代码,粘贴到new ssh keys的key里面,取一个名字,保存即可.
图56.回到图0,把途中命令行在git bash中逐行粘贴运行.
!!!!!!!!!!!!注意这里需要使用SSH的仓库地址,下面的https有时候会push失败!!!!!!!!!!!!!!!
echo "# blog" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/MRF3247/blog.git
git push -u origin master
7.如果最后一行运行后出现如图的字样即表示在git hub中成功同步了.(期间可能会弹出github的登陆窗口要登陆下),刷新图0页面就会看到结果了.
提交commit
1.打开vsc.
2.打开仓库中的代码(blog>readme.md),并输入一段文字如'my first commit'.
3,点击'源代码管理'(ctrl+shift+g),输入消息如'我的第一次提交',保存,点下勾号提交,并在勾号右边菜单点击'推送'
4.等推送完成后刷新github页面即可,之后就可以在这个仓库里把自己写的垃圾代码都提交上来了
网友评论