## TL;DR

Upgrade OPAL to 0.1.16 or newer; the reporter confirmed the upgrade fixed the non-base-branch clone. OPAL server failed to clone a private policy repo when OPAL_POLICY_REPO_MAIN_BRANCH was set to a non-default branch (e.g. dev), with errors like did not find main branch.

## Steps

1. OPAL server failed to clone a private policy repo when OPAL_POLICY_REPO_MAIN_BRANCH was set to a non-default branch (e.g. dev), with errors like did not find main branch. Cloning worked when the default branch was used, but a configured non-base branch broke the clone. The config used OPAL_POLICY_REPO_MAIN_BRANCH=dev with a private repo over SSH.

2. Upgrade OPAL to 0.1.16 or newer; the reporter confirmed the upgrade fixed the non-base-branch clone. The maintainer could not reproduce it on 0.1.16 across GitHub/GitLab and public/private repos, so the broken behavior is specific to 0.1.12 and earlier. The reporter's setup used a private repo, which the maintainer's 0.1.16 verification also covered.

## When to use

You are seeing this: The config used OPAL_POLICY_REPO_MAIN_BRANCH=dev with a private repo over SSH. Use this skill when you run into "OPAL cannot clone private repo with non-default main branch (fixed in 0.1.16)".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

Versions mentioned in the source: 0.1.16, 0.1.12. If you are on something much newer or older, the details may have shifted.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
