git 基本安装&配置&使用

一、基本安装
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 -am ‘delete remote file filename’
  3. git push origin branchname
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值