
Research
/Security News
PolinRider Spreads Through Compromised GitHub Accounts and Packagist
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.
@cuiguojie/gap
Advanced tools
自动根据 Git 远程仓库 URL 切换 Git 配置和 SSH 密钥的工具。
npx @cuiguojie/gap <command>
pnpm dlx @cuiguojie/gap <command>
# 或
pnpm exec @cuiguojie/gap <command>
bunx @cuiguojie/gap <command>
npx @cuiguojie/gap init
设置 profile 文件存储目录,默认:~/.git-auto-profile/profiles
npx @cuiguojie/gap create
交互式创建 profile:
npx @cuiguojie/gap whoami
显示当前 Git 配置和激活的 profile
npx @cuiguojie/gap list
列出所有已创建的 profile 及其关联的 URL 模式
npx @cuiguojie/gap remove
交互式选择要删除的 profile
npx @cuiguojie/gap create
# Profile name: work-github
# Git user.name: Your Work Name
# Git user.email: work@company.com
# SSH key: ~/.ssh/id_ed25519_work
# URL pattern: git@github.com:company/**
npx @cuiguojie/gap create
# Profile name: personal-github
# Git user.name: Your Name
# Git user.email: personal@example.com
# SSH key: ~/.ssh/id_ed25519_personal
# URL pattern: git@github.com:your-username/**
支持各种 Git 平台:
git@github.com:username/**git@your-gitlab.com:group/**支持通配符匹配:
** 匹配任意字符(包括路径分隔符)* 匹配任意字符(不包括路径分隔符)示例:
git@github.com:your-org/** - 匹配组织下所有仓库git@gitlab.com:company/project-* - 匹配特定前缀的项目git@*.company.com:*/** - 匹配公司所有 GitLab 实例~/.gitconfig 中添加 managed blockincludeIf 规则根据远程 URL 动态加载配置.conf 文件~/.git-auto-profile/
├── config.json # 工具配置
└── profiles/
├── work-github.conf # 工作配置
├── personal-github.conf # 个人配置
└── client-xyz.conf # 客户配置
# 克隆项目
git clone <repo-url>
cd git-auto-profile
# 安装依赖
npm install
# 测试本地版本(在项目内使用)
npm run start init
npm run start create
# 或临时全局测试
npm link
npx @cuiguojie/gap --help
# 构建发布版本
npm run build
src/
├── cli.ts # CLI 入口
├── commands/ # 命令实现
│ ├── init.ts # 初始化
│ ├── create.ts # 创建 profile
│ ├── list.ts # 列出 profile
│ ├── remove.ts # 删除 profile
│ └── whoami.ts # 查看当前配置
├── gitconfig-manager.ts # Git 配置管理
└── utils.ts # 工具函数
npx @cuiguojie/gap <command>
pnpm dlx @cuiguojie/gap <command>
# 或
pnpm exec @cuiguojie/gap <command>
bunx @cuiguojie/gap <command>
A: 直接编辑 ~/.git-auto-profile/profiles/[profile-name].conf 文件,或使用 npx @cuiguojie/gap remove 后重新创建。
A: 待测试
A: 不会。工具只在 managed block 内操作,不会影响现有配置。
# 查看详细输出
npx @cuiguojie/gap whoami
# 检查配置文件
cat ~/.gitconfig
ls ~/.git-auto-profile/profiles/
MIT License - 详见 LICENSE 文件
FAQs
Automatic Git profile switching based on remote URL patterns
The npm package @cuiguojie/gap receives a total of 6 weekly downloads. As such, @cuiguojie/gap popularity was classified as not popular.
We found that @cuiguojie/gap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.

Research
/Security News
Operators behind PolinRider used a compromised GitHub account to plant malware in four development versions of a Packagist package with 700,000+ downloads.

Security News
GitHub Actions now supports cache-mode, a least-privilege control on the Actions cache aimed at the cache poisoning technique behind recent compromises.

Company News
Allow myself to introduce... myself.