I was about to check out a remote repository when I got the following error:
git clone https://xyz git-repo/
Cloning into 'git-repo'...
Username for 'https://xyz': xyz
Password for 'https://xyz':
remote: Counting objects: 138872, done.
remote: Compressing objects: 100% (35137/35137), done.
Receiving objects: 100% (138872/138872), 24.25 MiB | 10.10 MiB/s, done.
remote: Total 138872 (delta 67002), reused 137198 (delta 66062)
Resolving deltas: 100% (67002/67002), done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.
In this case, it was due to a missing master branch. I needed to add a branch name to the checkout command with -b and the checkout worked as expected.