#Git
共 129 篇文章
解决 Git 报错 fatal: refusing to merge unrelated histories 的排查指南
排查与解决 Git 拉取或合并远程分支提示 refusing to merge unrelated histories 拒绝合并无关历史的完整方案。
解决 Git 报错 could not read Username terminal prompts disabled
分析 CI/CD 自动化构建容器中 git clone 报 could not read Username 根因,提供 URL 嵌入 Token 与 .netrc 凭证配置方案。
解决 GitLab CI 报错 rules:changes always evaluating true 条件误判修复
排查 GitLab CI 配置了 rules:changes 仅在修改了前端代码时才执行构建,但在合并分支或定时流水线中该 Job 总是无条件执行,分析 compare_to 基准分支与 Git 提交上下文。
Git merge 报 untracked working tree files would be overwritten 修复
分析 Git 执行 pull、merge 或 checkout 时提示 error: Your local changes / untracked files would be overwritten by merge 的底层机理与 stash 暂存实战。
Git 操作报错 git-lfs filter-process: git-lfs: command not found 排查
解决缺少 Git LFS 环境时克隆仓库报错 filter-process: command not found 的跳过与安装方案。
解决 Git 报错 filename too long 路径超长限制
在 Windows 平台拉取或检出深层前端 Monorepo 项目时,Git 报错 error: unable to create file ...: Filename too long。本文详解 Windows MAX_PATH 260 字符限制原理与通过 core.longpaths 解除限制的标准配置。
解决 Nx 报错 Cannot detect affected projects base branch 基线分支失配修复
排查 在 CI 流水线中执行 nx affected --base=origin/main 校验增量受影响项目时报错 Fatal: Not a valid object name origin/main,分析 Git Shallow Clone 与受影响依赖图对比基线。
Git 报错 error: could not lock config file .git/config 权限排障
执行 git config 或 git remote 时抛出 error: could not lock config file .git/config: Permission denied。本文深入剖析 sudo 误用导致的所有者污染机理与 chown 修复实战。
解决 Drone CI 报错 Clone failed SSL certificate problem 证书校验失败修复
排查 Drone CI 在拉取自建 GitLab/Gitea 代码仓库时,默认的 clone 步骤报错 fatal: unable to access: SSL certificate problem: self-signed certificate,分析 自签 CA 证书注入与 DRONE_GIT_ALWAYS_AUTH。
解决 Turborepo 报错 Uncommitted changes detected in dry-run 严格模式报错修复
排查 CI 流水线运行 turbo 报 error: working directory is not clean 或 uncommitted changes in strict mode,分析 git 工作区干净检查与生成文件忽略。
解决 Git 报错 fatal: refusing to merge unrelated histories: 变基合流
分析 Git pull --rebase 首次拉取无共同祖先分支报 unrelated histories 根因,提供规范合并与合流方案。
解决 Git 报错 fatal: empty ident name (or email) not allowed 的排查指南
排查与解决 Git 执行提交提示 empty ident name (or email) not allowed 空身份标识的完整方案。
Git 拉取子模块报错 fatal: reference is not a tree:排查 submodule 悬空提交
开发者在克隆或拉取包含子模块(Submodule)的代码库时,构建流水线突然中断,提示子模块引用的目标 Commit 在远端根本不存在。深入排查父仓库提前提交、子模块代码未推送到远端导致指针悬空的经典困境与修复流程。
Git clone 提示 fatal: early EOF 与 index-pack failed 修复
分析 Git 在拉取包含超大文件或上万历史提交的巨型代码仓库时报 fatal: early EOF / fetch-pack: invalid index-pack output 的诱因与分阶段浅克隆调优方案。
解决 Git 报错 Your local changes would be overwritten by merge 修复
排查 git pull 提示 error: Your local changes to the following files would be overwritten by merge,使用 git stash 暂存修改或使用 hard 重置。
解决 Git 报错 refusing to merge unrelated histories 不相关历史修复
排查 git pull 或 git merge 远程分支提示 fatal: refusing to merge unrelated histories 错误,添加 --allow-unrelated-histories 参数合并两套提交树。
解决 Git 子模块检出报错 You are in 'detached HEAD' state
分析 Git submodule update 导致处于游离头指针诱因,详解绑定跟踪分支与正确代码合入规范。
Git 克隆大仓库报 error: RPC failed; curl 56 GnuTLS recv error 排查
排查 Git clone 超大仓库时出现 RPC failed curl 56 传输中断的底层网络缓冲与 HTTP 限制解决方案。
解决 Git 报错 Permission denied (publickey) SSH 密钥认证失败
执行 git clone 或 git push 时提示 Permission denied (publickey). fatal: Could not read from remote repository。本文详解 SSH 密钥生成算法变更(OpenSSH 8.8+ 废弃 SHA-1)、~/.ssh/config 主机映射及权限配比排障流程。
解决 Git 报错 fatal: Unable to create .git/index.lock File exists
分析 Git 执行操作被中断残留 .git/index.lock 文件导致后续命令被锁定的根因,提供安全清理与后台僵尸进程排查步骤。


