- 公匙生成:ssh-keygen -t rsa -C “email@email.com” 注意:这里的 xxxxx@xxxxx.com 只是生成的 sshkey 的名称,并不约束或要求具体命名为某个邮箱。
现网的大部分教程均讲解的使用邮箱生成,其一开始的初衷仅仅是为了便于辨识所以使用了邮箱。按照提示完成三次回车,即可生成 ssh key。通过查看 ~/.ssh/id_ed25519.pub 文件内容,获取到你的 public key - 初始化仓库:git init。注意在仓库文件夹内进行初始化
 - 设置用户标识:git config 
  
- git config --global user.name "***" #名称
 - git config --global user.email ****@qq.com #邮箱
 
 - 提交文件到暂存区:git add 文件名。 
  
- 将单个文件到暂存区:git add 1.md
 - 将多个文件到暂存区:git add doc.md user/profile.txt
 - 将 user 目录添加到暂存区:git add user
 - 添加所有跟踪和未跟踪文件的更改:git add . 或 git add -A 或 git add --all
 - 只更新已被跟踪文件:git add -u 或 git add --update
 
 - 提交暂存区的指定文件到仓库区:git commit 
  
- 添加提交信息:git commit -m '提交信息'
 - 添加提交信息与未执行add指令的信息:git commit -a -m ‘提交信息’
 
 - 查看提交状态:git status
 - 清除之前的git地址:git remote rm origin
 - 添加Git地址:git remote add origin git@gitee.com:xxx.git
 - 拉去仓库代码:git pull origin master
 - 推送仓库代码:git push origin master 
  
- 将本地的 master 分支推送到 origin 主机的 master 分支:git push origin master
 - 如果本地版本与远程版本有差异,但又要强制推送可以使用 --force 参数:git push --force origin master
 
 - 克隆仓库:git clone 
  
- 克隆到当前路径:git clone <repo> repo:Git 仓库
 - 克隆到指定路径:git clone <repo> <directory> repo:Git 仓库、directory:本地目录
 
 










