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
相关推荐
蜀中廖化2 小时前
Android Studio 导入 opencv
android·opencv·android studio
奋斗的小鹰2 小时前
ASM Bytecode Viewer 插件查看kotlin和java文件的字节码
android·kotlin·asm
欢喜躲在眉梢里5 小时前
mysql中的日志
android·运维·数据库·mysql·adb·日志·mysql日志
路上^_^6 小时前
安卓基础组件019-引导页布局001
android·安卓
梦终剧7 小时前
【Android之路】UI消息循环机制
android·ui
zh_xuan7 小时前
Android android.util.LruCache源码阅读
android·源码阅读·lrucache
梦终剧7 小时前
【Android之路】安卓资源与编译初步
android
mykrecording9 小时前
launch Activity流程
android·app
不知名的前端专家10 小时前
uniapp 安卓FTP上传下载操作原生插件
android·uni-app
ClassOps11 小时前
Android Studio Logcat中 杀死应用
android·android studio·logcat