git小白入门

╄→尐↘猪︶ㄣ 提交于 2020-03-08 18:36:09

一、基本安装
1.安装本地git
阿里镜像:https://npm.taobao.org/mirrors/git-for-windows/v2.25.0.windows.1/
2.本地生成ssh公钥
教程
https://git-scm.com/book/zh/v2/%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E7%9A%84-Git-%E7%94%9F%E6%88%90-SSH-%E5%85%AC%E9%92%A5
3.复制本地公钥到github账户
在这里插入图片描述
4.本地链接远程仓库
A.创建github仓库,复制仓库的SSH key
在这里插入图片描述
B.本地链接
教程:https://www.runoob.com/w3cnote/git-guide.html
在这里插入图片描述
Ps:解决 fatal: Not a git repository (or any of the parent directories): .git 问题
使用git init 创建.git 即可

二、基本使用
在这里插入图片描述

教程: https://www.runoob.com/w3cnote/git-guide.html

提交:
1.git clone 克隆远端仓库到本地
2.git add filename 本地修改的文件添加到缓存区 git status 查看状态
3.git commit -m filename 提交文件到本地仓库
4.git push origin master 推送主分支到远端仓库

分支相关:

  1. git checkout -m branch1name 创建并切换到分支1
  2. 提交到远端add -> commit -> push
  3. git checkout branch1name 切换分支
  4. git branch 查看分支

删除远端文件:

  1. git rm filename1
  2. git commit -m ‘delete remote file filename’
  3. git push origin branchname
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!