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
相关推荐
小乖写代码1 小时前
49款开源Android小游戏
android·游戏
三少爷的鞋1 小时前
小团队的最优解:单 Module + 包内 Clean 架构
android
爱和冰阔落1 小时前
【Linux】两个毫无关系的进程怎么通信?命名管道 FIFO 从原理到 Server/Client 实战
android·linux·数据库·c++·vim
年小个大11 小时前
受 go-zero 启发,我给 Flutter 写了一套 CLI 脚手架
android·flutter·架构
Android-Flutter12 小时前
为什么说ActivityThread是主线程?
android·kotlin
余额瞒着我当琳14 小时前
C++模板初阶与STL初探
android·java·c++
知行合一。。。16 小时前
DeepAgents--01--Agent和OpenClaw的相关概念
android·数据库
汪海游龙18 小时前
告别 Play Console 手动上传:从模拟器截图到自动发版的完整流水线
android·ci/cd·github
weixin_4407841118 小时前
【IntentSeivice实现原理】
android·java·开发语言·intentservice
delta_hell18 小时前
【阅读源码--Android】动画之ValueAnimator--2
android·源码·valueanimator