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 = [email protected]
shell 复制代码
# ~/.gitconfig_work

[user]
    name = your_work_name
    email = [email protected]
相关推荐
开发之奋斗人生6 小时前
android关于pthread的使用过程
android·pthread
wu_android8 小时前
Android 视图系统入门指南
android
淡淡的香烟8 小时前
Android11 Launcher3实现去掉抽屉改为单层
android
火柴就是我8 小时前
每日见闻之THREE.PerspectiveCamera的含义
android
小书房9 小时前
Android的Dalvik和ART
android·aot·jit·art·dalvik
夏日玲子9 小时前
Monkey 测试的基本概念及常用命令(Android )
android
whysqwhw9 小时前
Transcoder代码学习-项目构建
android
夕泠爱吃糖9 小时前
Linux 文件内容的查询与统计
android·linux·c#
yzpyzp10 小时前
Kotlin的MutableList和ArrayList区别
android·kotlin
用户20187928316710 小时前
故事:《安卓公司的消息快递系统》
android