Git Errors
Merge conflicts, rejected pushes, detached HEAD, LFS and repository corruption.
Understanding Git errors
Git errors are frightening mostly because the messages describe internal state rather than what to do. The reassuring fact is that almost nothing is lost: git reflog records every position HEAD has held, so a bad rebase, a hard reset or a deleted branch is nearly always recoverable. Before running any destructive command, note the current commit hash.
How to debug Git errors
- Run
git statusand read it fully. It tells you the current state and usually names the exact command to move forward or abort. - Use
git reflogto find any commit you think you have lost, thengit reset --hard <hash>orgit branch recovery <hash>to get it back. - For a rejected push, run
git fetchthengit log --oneline HEAD..@{u}to see exactly what is on the remote that you do not have. Prefer--force-with-leaseover--force, which refuses to overwrite work you have not seen. - Abort rather than improvise when a merge or rebase goes wrong:
git merge --abort,git rebase --abort,git cherry-pick --abort. - For repository corruption, run
git fsck --full. If objects are missing, re-cloning and cherry-picking your local work is usually faster and safer than repairing in place.
Tools worth reaching for
git statusgit refloggit fsck --fullgit log --graph --oneline --allgit diff --check
All 20 Git errors
- git cherry-pick: conflictThe commit being cherry-picked modifies lines that diverged on the target branch, so Git needs manual conflict…
- Git LFS: missing objectsGit LFS pointer files exist but the actual large file content was not downloaded. The LFS server may be unreachable or…
- git: cannot lock refAnother Git process is holding a ref lock or a stale .lock file remains from a crashed Git process.
- Git: CONFLICT during rebaseA merge conflict occurred while replaying commits during a rebase. The same lines were modified in both branches.
- Git: Could not apply stashApplying a stash caused conflicts because the working tree has diverged from when the stash was created.
- git: detected dubious ownership in repository NewGit refuses to operate on a repository owned by a different user than the one running git. This safety check blocks a…
- git: error: pathspec 'x' did not match any file(s) known to git NewGit could not resolve the argument as a file, branch or commit. With checkout it usually means the branch exists only…
- Git: failed to push some refs to ... (non-fast-forward)Remote branch has commits that you don't have locally. Someone else pushed changes.
- git: fatal: Authentication failed for 'https://github.com/...' NewGitHub removed password authentication for Git over HTTPS in 2021, and most hosts have followed. A cached account…
- Git: File size exceeds limitGitHub/GitLab rejects push because file exceeds size limit (typically 100MB). Need Git LFS.
- Git: Merge conflictCannot automatically merge changes because same lines were modified in different branches.
- git: object file is empty / loose object is corruptA Git object under .git/objects is unreadable, commonly after a crash, cloud-sync conflict, or filesystem issue.
- git: refusing to merge unrelated histories NewThe two branches have no common ancestor. This normally means a local repository was initialised separately from the…
- Git: remote rejected (protected branch)Direct push to a protected branch was rejected. The branch requires pull requests or specific permissions.
- git: RPC failed; HTTP 400 curl 22 / the remote end hung up unexpectedly NewThe push exceeded a size limit somewhere in the chain: the HTTP post buffer, a reverse proxy body limit, or the…
- git: SSL certificate problem: unable to get local issuer certificate NewGit could not build a trust chain to the server's certificate, almost always because a corporate proxy re-signs TLS…
- Git: Submodule path not initializedA git submodule was not initialised or updated after cloning. The submodule directory is empty.
- Git: You are in 'detached HEAD' stateChecked out a specific commit directly instead of a branch. New commits will not be associated with any branch and may…
- git: You have divergent branches and need to specify how to reconcile them NewLocal and remote have both moved on, and since Git 2.27 pull refuses to guess between merging and rebasing. The hint…
- git: Your local changes to the following files would be overwritten by merge NewGit is protecting uncommitted work in files the incoming commits also touch, so nothing has been merged yet. When the…
Other categories
- AI 35Rate limits, context windows, GPU memory and model-serving failures.
- Ansible 10Unreachable hosts, become passwords, undefined variables and Jinja2 failures.
- API 14Auth headers, payload limits, versioning, idempotency and webhook signatures.
- Apple 10Command line tools, dyld, Homebrew permissions, notarisation and Keychain.
- Auth 11OIDC, SAML, Auth0, Okta, Keycloak, passkeys and MFA failures.
- BigData 11Spark, Kafka, Airflow, Snowflake, Flink and Databricks failures.
- C# 12NuGet restore, null references, EF Core migrations, async deadlocks and Blazor…
- C++ 11Segfaults, linker errors, memory corruption and template deduction failures.
- Caching 10Cache stampedes, stale content, Varnish and CloudFront failures.
- CI/CD 18GitHub Actions, GitLab CI, Jenkins, CircleCI: permissions, runners and…
- Client 21CORS, mixed content, module resolution, memory limits and framework runtime…
- Cloud 25IAM permissions, quotas, service limits and credential failures.
- Dart 10Null safety, pub version solving and build toolchain problems.
- Database 41Connections, deadlocks, constraints, replication and memory limits.
- DNS 10NXDOMAIN, SERVFAIL, timeouts, propagation and delegation problems.
- Docker 27Daemon connectivity, disk space, image pulls, ports and architecture mismatches.
- Elixir 9GenServer timeouts, supervision failures and Mix compilation problems.
- Email 8Delivery failures, relay denial, authentication, SPF, DKIM and DMARC.
- Frontend 23Hydration mismatches, bundler resolution, layout shift and font loading.
- Go 19Nil map assignment, concurrent map access, context cancellation and deadlocks.
- GraphQL 13Validation, depth limits, N+1 queries and fragment problems.
- gRPC 10Status codes, deadlines, message limits, TLS and HTTP/2 transport failures.
- HTTP 494xx client errors, 5xx server errors, redirects, headers and protocol problems.
- ICMP 23Destination unreachable, time exceeded, fragmentation needed and redirects.
- Ingress 8404 default backend, missing TLS secrets, IngressClass and path matching.
- Java 19Class loading, dependency resolution, connection pools and JVM version…
- JavaScript 42npm resolution, async pitfalls, hydration, memory limits and runtime type…
- Kubernetes 34CrashLoopBackOff, ImagePullBackOff, OOMKilled, RBAC, scheduling and storage.
- Logging 9Log4j, Logback, Fluentd, Logstash and CloudWatch ingestion problems.
- MessageQueue 14Kafka, RabbitMQ, SQS, NATS and Celery: lag, rebalancing and poison messages.
- Mobile 17Gradle, CocoaPods, Xcode signing, Metro bundler and toolchain mismatches.
- Monitoring 12Prometheus scrapes, Grafana data sources, OpenTelemetry exporters and agent…
- Network 35Refused connections, timeouts, resets, MTU problems and port exhaustion.
- Performance 6GC pauses, thread pool starvation and event loop blocking.
- PHP 11Memory limits, execution timeouts, autoloading, Composer and PDO connections.
- Proxy 17nginx, Envoy, HAProxy, Traefik, Caddy and Cloudflare upstream failures.
- Python 35Imports, virtual environments, encoding, concurrency and dependency conflicts.
- Regex 8Catastrophic backtracking, back references, escaping and engine differences.
- Ruby 11Bundler, migrations, native extensions, encoding and asset compilation.
- Rust 19Borrow checker, ownership moves, trait bounds and lifetime mismatches.
- Scala 6Dependency resolution, binary compatibility and type inference failures.
- Security 25JWT validation, CSRF, OAuth grants, SELinux, SSH host keys and CSP.
- Serverless 11Lambda timeouts, package size limits, VPC networking and cold starts.
- Shell 13Command not found, permissions, quoting, expansion and Makefile syntax.
- Storage 13S3 permissions, NFS mounts, quotas, signed URLs and volume attachment.
- Svelte 10Store subscriptions, load functions and server/client boundaries.
- System 26Disk space, systemd units, file descriptors, OOM killer and scheduled jobs.
- Terraform 18State locks, provider auth, drift, dependency cycles and plan-time unknowns.
- Testing 18Jest, pytest, JUnit, Cypress and Playwright: fixtures, snapshots and timeouts.
- TLS 24Untrusted authorities, expiry, hostname mismatch, chains and cipher negotiation.
- TypeScript 19Assignability, missing declarations, strict null checks and generic constraints.
- Virtualization 8VirtualBox, VMware, Hyper-V, WSL, KVM and hypervisor conflicts.
- Web3 7Gas estimation, nonce management and reverted transactions.
- WebAssembly 7Compile errors, memory bounds and host binding mismatches.
- WebServer 10nginx, Apache, IIS and Caddy: binding, permissions, rewrites and TLS.
- Windows 10Installer failures, missing runtimes, update errors and permission problems.