# Troubleshooting Git

Fixes for the errors you can hit when pushing, cloning, merging and receiving webhooks.

## `Authentication failed` over HTTPS

**Cause:** a wrong, expired or deleted token.

**Fix:** give the token's prefix as the username and its secret as the password, or the whole
token in either field; or create a new token. See [Clone over HTTPS](clone-over-https.md).

## `Permission denied (publickey)` over SSH

**Cause:** the key is not on your account, or the deploy key is for a different repository.

**Fix:** add the key under **Account → SSH keys**, or add a deploy key to this repository. See
[Clone over SSH](clone-over-ssh.md).

## Push refused: "branch … is protected"

**Cause:** a branch protection rule on that branch: it requires a pull request, blocks force
pushes (`does not allow non-fast-forward pushes`) or blocks deleting the branch
(`cannot be deleted`).

**Fix:** open a pull request; the message says how many approvals it needs. For a refused force
push, merge or rebase onto the branch and push a fast-forward. See
[Protect a branch](protect-a-branch.md).

## Push refused: "tag … is protected"

**Cause:** a tag protection rule matches the tag, and you lack `git:PushProtectedTag` (a deploy key
never has it).

**Fix:** push the tag with a principal that holds `git:PushProtectedTag`. See
[Protect tags](protect-tags.md).

## Push refused: "requires a merge queue"

**Cause:** the branch's rule requires the merge queue.

**Fix:** open a pull request and choose **Merge when ready**. See
[Use a merge queue](use-a-merge-queue.md).

## Push refused: "Push blocked by secret scanning"

**Cause:** the push adds a value in a known credential format.

**Fix:** remove it from the commits, or push with a reason. See
[Handle a push blocked by secret scanning](handle-a-blocked-push.md).

## Push refused: "this repository mirrors … and cannot be written to"

**Cause:** an imported repository in mirror mode refuses pushes.

**Fix:** stop mirroring under **Settings → Mirroring** (`git:StopMirroring`). See
[Import a repository](import-a-repository.md).

## The merge button is disabled

**Cause:** the pull request is a draft, has conflicts, lacks approvals or code owner approvals, has
failing checks, or its branch requires the merge queue.

**Fix:** the pull request page names which. Mark a draft ready with **Ready for review** (see
[Open a pull request](open-a-pull-request.md)). For conflicts caused by the target moving, bring
the branch up to date with `dcloud git branches update-from`.

## A queued pull request is removed: "Required checks did not finish within … minutes"

**Cause:** the required checks did not report on the queue's build within the rule's status check
timeout (60 minutes by default), often because no workflow runs for `merge_group`.

**Fix:** add `merge_group` to the workflow's `on:`, or raise **Status check timeout (minutes)** on
the branch protection rule.

## A webhook never arrives

**Cause:** the URL is unreachable, resolves to a private address, redirects, takes longer than 10
seconds, or does not return 2xx.

**Fix:** check the endpoint and its recent deliveries. A 5xx, 408, 429 or connection failure is
retried, up to 5 attempts, and then marked **Failed**; any other 4xx fails at once. See
[View webhook deliveries](view-webhook-deliveries.md).

## `429` when cloning a public repository

**Cause:** anonymous requests are limited per address.

**Fix:** wait for `Retry-After`, or clone with a token.
