Git基本用法2.24

1. 下载安装git

1.1 下载(略)

1.2 安装

Git基本用法2.24

Git基本用法2.24

Git基本用法2.24

Git基本用法2.24

Git基本用法2.24

Git基本用法2.24

Git基本用法2.24

Git基本用法2.24

Git基本用法2.24

点击下一步开始安装。 

1.3 创建本地repository仓库

安装完成后,打开Git Gui。

点击Create New Repository

Git基本用法2.24

选择路径:  

Git基本用法2.24

Git基本用法2.24

1.4 生成SSH keys

重要的第一步就是生成RSA的key**。2.24版本的点击 Help--帮助 > Generate SSH Key--生成SSH Key。这里我们可以生成自定义的RSA**,私钥自己保存,公钥发布出去。Where?生成**过程中,需要输入和确认密码,这个密码就是用来检验数字证书的,以后会用到须妥善保存。操作完毕后,在Help菜单里Show SSH Key查看public key公钥。

Git基本用法2.24

2 配置git相关

2.1 配置github账号的SSH key

接下来打开注册的github账号。点击右上方头像。

Git基本用法2.24

点击Settings > SSH and GPG keys: 

Git基本用法2.24

Git基本用法2.24

>"New SSH Key"

Git基本用法2.24

Title任意写, Key就是Public key公钥,刚才生成的。复制粘贴就行很简单。

Git基本用法2.24

2.2 测试连接github

从Git Gui菜单Repository打开Git Bash

Git基本用法2.24

Git基本用法2.24

输入命令:

$ git config --global user.email ******@***.com

$ git config --global user.username ******

$ git init

$ ssh -T [email protected]

Git基本用法2.24

Git基本用法2.24

Git基本用法2.24

Git基本用法2.24

 3 操作github repository仓库

3.1 创建github repository(略)

3.2 下载github仓库

克隆

$ git clone https://github.com/WowlNAN/qpath

3.3 更新仓库

$ git add .    #指定更新整个目录,如果在根目录,则更新整个项目;

$ git commit -m "Update message"

$ git push https://github.com/WowlNAN/qpath master

# git add file1 #指定更行当前目录的某个文件;

Git基本用法2.24

 

Git基本用法2.24

"Update message"是指更新说明,git push 第1个参数是repository仓库地址,第2个是分支:master

Git基本用法2.24

git命令帮助:

$ git --help