通过Git Bash使用Github的方式共分为如下几步:
1:下载和安装适合自己版本的Git Bash
官方网站为:https://git-scm.com/
2:打开Git Bash
$ cd ~/.ssh
$ mkdir key_backup
$ ssh-keygen -t rsa -C "youremail@youremail.com"
3:查看生成的id_rsa.pub文件,蠢了,没有选择的话,会自动生成在.ssh目录下,所有mkdir白mkdir了
$ cat id_rsa.pub
将内容复制一下,然后登录你的github:
点击New SSH Key,拷贝内容到文本框中即可。
4:在Git Bash中尝试链接:
$ ssh -T git@github.com
首次登录,ssh会让你确认一下,输入yes即可:
The authenticity of host 'github.com (13.229.188.59)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
而后,可以发现:
Warning: Permanently added 'github.com' (RSA) to the list of known hosts.
Hi ****! You've successfully authenticated, but GitHub does not provide shell access.
5:将远程克隆下来
$ git clone https://github.com/Nickname/repro.git dirName
其中,Nickname是你的github的昵称,repro是你的仓库名称,dirName是你想要将这个仓库克隆到哪个文件夹,如果没有,会新建的
6:进入这个文件夹,为项目地址起一个新名字
$ cd dirName
$ git remote set-url origin git@github.com:Nickname/repo.git
接下来,就可以通过origin来代替这个链接地址了~
7:编写代码,并查看变动,进行提交
$ git status
$ git add .
为本次提交,添加init的注释
$ git commit -m "init"

$ git push -u origin master
就可以了,再次提交前记得git pull以保持版本一致,如果有冲突的话,会进行提示,进行解决,解决后,再次提交即可,如果没有冲突,会提示你进行了哪些变化。