Git 根据不同目录设置不同账号

Git 根据不同目录设置不同账号

includeIf 配置

shell 复制代码
# 先创建 gitconfig 文件(如果不存在)
touch ~/.gitconfig
touch ~/.gitconfig_pers
touch ~/.gitconfig_work
shell 复制代码
# ~/.gitconfig

[core]
	longpaths = true # 允许处理长路径

# includeIf 的 gitdir 条件只会在实际 Git 仓库中生效,普通的文件目录不会触发条件包含
[includeIf "gitdir:C:/LouisPers/"] # 注意目录结尾不要少了 /,代表是个目录
    path = ~/.gitconfig_pers

[includeIf "gitdir:C:/LouisWork/"] # 注意目录结尾不要少了 /,代表是个目录
    path = ~/.gitconfig_work
shell 复制代码
# ~/.gitconfig_pers

[user]
    name = your_pers_name
    email = your_pers_email@example.com
shell 复制代码
# ~/.gitconfig_work

[user]
    name = your_work_name
    email = your_work_email@company.com
相关推荐
sc.溯琛7 小时前
MySQL 高级实战:触发器、事务与数据库备份恢复全攻略
android·adb
zhuzewennamoamtf8 小时前
Linux SPI设备驱动
android·linux·运维
雨声不在11 小时前
gradle编译missing_rules报错处理
android·gradle·agp8
用户70937225385113 小时前
配置vscode阅读Android native 代码
android
tangweiguo0305198713 小时前
Android OpenGL ES 2.0 完整开发指南:从零到三维旋转立方体
android
龚礼鹏13 小时前
AndroidStudio module编译aar混淆文件处理
android
程序员阿鹏15 小时前
MySQL中给字段添加唯一约束的方式有哪些?
android·数据库·mysql
三少爷的鞋17 小时前
Android Data 层设计的四条红线:为什么必须坚持、如何落地
android
猫豆~17 小时前
zabbix实战——3day
android
知行合一。。。18 小时前
Python--01--核心基础
android·java·python