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
相关推荐
北京自在科技9 小时前
谷歌 Find Hub 迎来新版本更新
android·安卓
古法安卓15 小时前
Android-休眠唤醒后onLocationChanged没有数据问题排查
android·java·android studio
Htr_17 小时前
Creem 2.0 使用指南:面向 AI 构建时代的资金平台
android·数据库·人工智能·ui·photoshop
wardenlzr19 小时前
车机看门狗(Watchdog)为何会让整机硬重启
android·优化·车机
IT毕设实战小研19 小时前
基于大数据的商场商铺数据分析与可视化的设计与实现
android·java·大数据·django·课程设计
aqi0020 小时前
一文读懂 HarmonyOS 7.0 带来的十大API重要升级
android·华为·harmonyos·鸿蒙·harmony
是店小二呀20 小时前
鸿蒙PC开源移植:CodeLite原生IDE与Remote Agent适配
android·智能手机·远程桌面
终端安全笔记21 小时前
iOS 27 给了租赁一个新工具,但它只认受监督的设备
android·网络·安全·ios
爱笑鱼1 天前
Android 系统启动机制(八):系统服务怎样从创建走到可用?SystemServiceManager 和 Boot Phase 各管什么?
android