0
点赞
收藏
分享

微信扫一扫

Java项目:基于SSM框架实现的网上医院预约挂号系统【ssm+B/S架构+源码+数据库+毕业论文】

1kesou 2024-07-24 阅读 22
为什么要手动配置脚本

手动配置脚本,好比是一个专家模式,它能加深你对Git的理解

如果纯粹复制粘贴网上的指令,不懂得其中原理,项目一多,仓库一多,发生冲突时自己就没法解决

Git的脚本非常简单,熟悉其格式和原理后,配置效率比指令要高很多

Git主要配置文件说明
  • 全局配置,USER_HOME/.gitconfig
  • 项目配置,PROJECT_ROOT/.git/config
  • 忽略配置,由config文件中的core.excludesFile项指定,可以指定一个文件作为gitignore配置文件
  • 项目配置和全局配置不一致时,会覆盖全局配置,excludesFile则是叠加关系
说明

本教程以Mac为例,指令和用户目录,大家根据实际系统自行调整

-t表示以纯文本格式打开,linux下需要忽略-t参数

打开配置文件
open -t /Users/easing/.gitconfig
open -t /Users/easing/YourProjectRootPath/.git/config
修改配置文件
[user]
	name = easing
	email = xxx@xxx.com
	password = xxxxxx

[github]
	user = xxx@xxx.com
	token = xxxxxx

[core]
	excludesFile = /Users/easing/local.gitignore
	autocrlf = input

[pull]
	rebase = false

[http]
	version = HTTP/1.1
	proxy = socks5://127.0.0.1:7890
打开GitIgnore文件
open -t /Users/easing/local.gitignore
修改GitIgnore文件
**/.idea
**/.gradle
**/.local
**/.DS_Store
**/local.properties
刷新项目缓存
git rm -r --cached .  
git add .
git commit -m "modify git ignore rule"
常用配置功能说明
  • user,用于配置GitLab等仓库的默认用户,邮箱,密码
  • github,用于配置GitHub仓库的默认用户和授权token
  • core.excludesFile,用于指定GitIgnore配置文件
  • core.autocrlf,配置回车换行字符的编码方式
  • pull.rebase,指定合并用merge还是rebase
  • http.version,配置使用的http版本,可解决github http2.0错误问题
  • http.proxy,配置代理地址,可解决github pull/push慢的问题
举报

相关推荐

0 条评论