Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to determine default branch using refs/remotes/origin/HEAD #1267

Closed
fschrempf opened this issue Jun 18, 2024 · 3 comments
Closed

Failed to determine default branch using refs/remotes/origin/HEAD #1267

fschrempf opened this issue Jun 18, 2024 · 3 comments

Comments

@fschrempf
Copy link

gitlab-ci-local uses git symbolic-ref --short refs/remotes/origin/HEAD to determine the remote default branch in GitLab. Depending on how the local repository was setup, this might not be available (see this link for details) and causing failures like this:

Error: Command failed with exit code 128: git symbolic-ref --short refs/remotes/origin/HEAD

A workaround is to add the symbolic-ref manually as described here.

A fix might be possible by parsing the output from git remote show origin to determine the default branch as described here.

Expected behavior

gitlab-ci-local runs without failure even if refs/remotes/origin/HEAD is not available

Host information
Manjaro
gitlab-ci-local 4.50.1

Containerd binary
podman version 5.1.0

@ANGkeith
Copy link
Collaborator

ANGkeith commented Jun 18, 2024

Expected behavior
gitlab-ci-local runs without failure even if refs/remotes/origin/HEAD is not available

most likely the issue whereas gitlab-ci-local crashes will be resolved by https://github.com/firecow/gitlab-ci-local/pull/1256/files

is this the error you're getting?
image

if yes, then on the next release, this issue will most likely be fixed

@ANGkeith
Copy link
Collaborator

ANGkeith commented Jun 18, 2024

A fix might be possible by parsing the output from git remote show origin to determine the default branch as described jhauberg/gitdoctor#3 (comment).

yup, i think git remote show origin will be a nice to have, but it's a very expensive operation. took ~ 4 seconds on my computer.

i don't think i'll be implementing it though, but if someone is, just take note of this, and maybe cache the result or something

@fschrempf
Copy link
Author

Confirming that 4.51.0 seems to fix the issue. Thanks! Great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants