Git学习:Git安装及配置

1 Git安装

1.1 安装地址

1.2 验证

windows版本的安装完成之后,会出现三个图标,大家可以根据操作习惯自行选择:
在这里插入图片描述

  • Git Bash:Unix与Linux风格的命令行,使用最多,推荐最多
  • Git CMD:Windows风格的命令行
  • Git GUI:图形界面的Git,不建议初学者使用,尽量先熟悉常用命令

安装完成后,可通过查看git版本号验证是否安装成功,命令为:

$ git --version

比如,我的版本为2.33.0.windows.2:
在这里插入图片描述

2 配置

Git提供“git config”命令,专门用来操作配置相关内容。

2.1 config 的三个作用域

命令作用域范围使用频率配置文件所在地
git config --locallocal 只对当前仓库有效.git/config
git config --globalglobal 对登录⽤户所有仓库有效工作当中最常用个人home目录下的.gitconfig
git config --systemsystem对系统的所有⽤户有效基本不用git安装目录

注意:缺省等同于 local

2.2 查看config配置

$ git config --list
$ git config --list --local 
$ git config --list --global 
$ git config --list --system

2.3 配置用户信息

配置用户信息,以local为例:

$ git config --local user.name "your_name"
$ git config --local user.email "your_email@xxx.com"

清除用户信息,以local为例:

$ git config --local --unset user.name
$ git config --local --unset user.email

2.4 操作示例

查看local配置,如下,没有配置用户名和邮箱:
在这里插入图片描述

配置用户名及邮箱:
在这里插入图片描述

查看当前配置信息,用户名邮箱已经设置成功:
在这里插入图片描述
清除用户名及邮箱:
在这里插入图片描述
查看当前配置信息,如下,用户名及邮箱已被清除:
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Git 2.33 Release Notes ====================== Updates since Git 2.32 ---------------------- UI, Workflows & Features * "git send-email" learned the "--sendmail-cmd" command line option and the "sendemail.sendmailCmd" configuration variable, which is a more sensible approach than the current way of repurposing the "smtp-server" that is meant to name the server to instead name the command to talk to the server. * The userdiff pattern for C# learned the token "record". * "git rev-list" learns to omit the "commit " header lines from the output with the `--no-commit-header` option. * "git worktree add --lock" learned to record why the worktree is locked with a custom message. Performance, Internal Implementation, Development Support etc. * The code to handle the "--format" option in "for-each-ref" and friends made too many string comparisons on %(atom)s used in the format string, which has been corrected by converting them into enum when the format string is parsed. * Use the hashfile API in the codepath that writes the index file to reduce code duplication. * Repeated rename detections in a sequence of mergy operations have been optimized out for the 'ort' merge strategy. * Preliminary clean-up of tests before the main reftable changes hits the codebase. * The backend for "diff -G/-S" has been updated to use pcre2 engine when available. * Use ".DELETE_ON_ERROR" pseudo target to simplify our Makefile. * Code cleanup around struct_type_init() functions. * "git send-email" optimization. * GitHub Actions / CI update. (merge 0dc787a9f2 js/ci-windows-update later to maint). * Object accesses in repositories with many alternate object store have been optimized. * "git log" has been optimized not to waste cycles to load ref decoration data that may not be needed. * Many "printf"-like helper functions we have have been annotated with __attribute__() to catch placeholder/parameter

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值