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 小时前
跨平台开发的抉择:Flutter vs 原生安卓(Kotlin)的优劣对比与选型建议
android·flutter·kotlin
jyan_敬言8 小时前
【C++】string类(二)相关接口介绍及其使用
android·开发语言·c++·青少年编程·visual studio
程序员老刘8 小时前
Android 16开发者全解读
android·flutter·客户端
福柯柯9 小时前
Android ContentProvider的使用
android·contenprovider
不想迷路的小男孩9 小时前
Android Studio 中Palette跟Component Tree面板消失怎么恢复正常
android·ide·android studio
餐桌上的王子9 小时前
Android 构建可管理生命周期的应用(一)
android
菠萝加点糖9 小时前
Android Camera2 + OpenGL离屏渲染示例
android·opengl·camera
用户20187928316710 小时前
🌟 童话:四大Context徽章诞生记
android
yzpyzp10 小时前
Android studio在点击运行按钮时执行过程中输出的compileDebugKotlin 这个任务是由gradle执行的吗
android·gradle·android studio
aningxiaoxixi10 小时前
安卓之service
android